new LoggingHandler(LogLevel.INFO),
new LocalEchoServerHandler());
}
});
Bootstrap cb = new Bootstrap();
cb.group(clientGroup)
.channel(LocalChannel.class)
.handler(new ChannelInitializer<LocalChannel>() {
@Override
public void initChannel(LocalChannel ch) throws Exception {
ch.pipeline().addLast(
new LoggingHandler(LogLevel.INFO),
new LocalEchoClientHandler());
}
});
// Start the server.
sb.bind(addr).sync();
// Start the client.
Channel ch = cb.connect(addr).sync().channel();
// Read commands from the stdin.
System.out.println("Enter text (quit to end)");
ChannelFuture lastWriteFuture = null;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));