{
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();
}
}