assertEquals( 1024, filter.getWriteBufferSize() );
}
public void testWriteUsingSocketTransport() throws Exception
{
IoAcceptor acceptor = new SocketAcceptor();
( ( SocketAcceptorConfig ) acceptor.getDefaultConfig() ).setReuseAddress( true );
SocketAddress address = new InetSocketAddress( "localhost", AvailablePortFinder.getNextAvailable() );
IoConnector connector = new SocketConnector();
FixedRandomInputStream stream = new FixedRandomInputStream( 4 * 1024 * 1024 );
SenderHandler sender = new SenderHandler( stream );
ReceiverHandler receiver = new ReceiverHandler( stream.size );
acceptor.bind( address, sender );
synchronized( sender.lock )
{
synchronized( receiver.lock )
{
connector.connect( address, receiver );
sender.lock.wait();
receiver.lock.wait();
}
}
acceptor.unbind( address );
assertEquals( stream.bytesRead, receiver.bytesRead );
assertEquals( stream.size, receiver.bytesRead );
byte[] expectedMd5 = stream.digest.digest();
byte[] actualMd5 = receiver.digest.digest();