1 4 package com.tc.net.protocol.transport; 5 6 import com.tc.bytes.TCByteBuffer; 7 8 import junit.framework.TestCase; 9 10 public class TransportHandshakeMessageTest extends TestCase { 11 12 private TransportHandshakeMessage message; 13 private TransportHandshakeMessageFactoryImpl factory; 14 15 public void setUp() throws Exception { 16 17 factory = new TransportHandshakeMessageFactoryImpl(); 18 19 } 20 21 public void testSendAndReceive() throws Exception { 22 boolean isMaxConnectionsExceeded = true; 23 int maxConnections = 13; 24 DefaultConnectionIdFactory connectionIDProvider = new DefaultConnectionIdFactory(); 25 ConnectionID connectionId = connectionIDProvider.nextConnectionId(); 26 message = factory.createSynAck(connectionId, null, isMaxConnectionsExceeded, maxConnections); 27 TCByteBuffer payload[] = message.getPayload(); 28 29 WireProtocolHeader header = new WireProtocolHeader(); 30 header.setProtocol(WireProtocolHeader.PROTOCOL_TRANSPORT_HANDSHAKE); 31 message = new TransportHandshakeMessageImpl(null, header, payload); 32 assertEquals(isMaxConnectionsExceeded, message.isMaxConnectionsExceeded()); 33 assertEquals(maxConnections, message.getMaxConnections()); 34 } 35 } 36 | Popular Tags |