@Test
public void data2() throws Exception
{
MyDataHandler dh = new MyDataHandler();
Tcp2Connection c = new Tcp2Connection( "tcp://127.0.0.1:"+port, r );
c.setSession( dh );
assertFalse( c.isStarted() );
c.start();
assertTrue( c.isStarted() );
SocketChannel t = lh.accepted.waitUntilNotEqAndSet( null, TIMEOUT, null );
assertWhat( What.UP, dh.what );
assertNull( dh.xsender );
assertNull( dh.xbuf );
byte[] buf = { 21, 22, 23 };
write( t, buf );
assertWhat( What.DATA, dh.what );
assertNull( dh.xsender );
assertNotNull( dh.xbuf );
assertEquals( 3, dh.xbuf.length );
assertEquals( (byte) 21, dh.xbuf[0] );
assertEquals( (byte) 22, dh.xbuf[1] );
assertEquals( (byte) 23, dh.xbuf[2] );
assertTrue( c.isStarted() );
c.stop();
assertFalse( c.isStarted() );
assertWhat( What.DOWN, dh.what );
assertNull( dh.xsender );
assertNull( dh.xbuf );