1
2
3
4
5
6
7
8
9
10
11 package org.mule.providers.tcp.protocols;
12
13 import org.mule.providers.tcp.TcpProtocol;
14 import org.mule.tck.AbstractMuleTestCase;
15
16 public class DefaultProtocolTestCase extends AbstractMuleTestCase
17 {
18
19 private TcpProtocol protocol;
20 private int expectedLength;
21
22 public DefaultProtocolTestCase()
23 {
24
25
26
27 this(new DefaultProtocol(), SlowInputStream.FULL_LENGTH);
28 }
29
30 public DefaultProtocolTestCase(TcpProtocol protocol, int expectedLength)
31 {
32 this.protocol = protocol;
33 this.expectedLength = expectedLength;
34 }
35
36
37 public void testRead() throws Exception
38 {
39 byte[] result = (byte[]) protocol.read(new SlowInputStream());
40 assertEquals(expectedLength, result.length);
41 }
42
43 protected TcpProtocol getProtocol()
44 {
45 return protocol;
46 }
47
48 }