客户端:
new Bootstrap()
.group(new NioEventLoopGroup())
.channel(NioSocketChannel.class)
.handler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
ch.pipeline().addLast(new StringEncoder());
}
}).connect(new InetSocketAddress("localhost", 9090))
.sync()
.channel()
.writeAndFlush("dsdsdsdsd");
服务端:
new ServerBootstrap()
.group(new NioEventLoopGroup())
.channel(N