newServerSocketChannelFactory(Executors.newCachedThreadPool()));
ConnectionlessBootstrap cb = new ConnectionlessBootstrap(
newClientSocketChannelFactory(Executors.newCachedThreadPool()));
final CountDownLatch latch = new CountDownLatch(1);
sb.getPipeline().addFirst("handler", new SimpleChannelUpstreamHandler() {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
super.messageReceived(ctx, e);
assertEquals(1, ((ChannelBuffer) e.getMessage()).readInt());
latch.countDown();
}
});
cb.getPipeline().addFirst("handler", new SimpleChannelUpstreamHandler());
Channel sc = sb.bind(new InetSocketAddress("127.0.0.1",0));
Channel cc = cb.bind(new InetSocketAddress("127.0.0.1", 0));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();