Unknown channel option 'TCP_NODELAY' for channel '[id: 0x65b21c67]'
解决方法
public class nettyServerSocket { public static void main(String[] args) throws InterruptedException { NioEventLoopGroup accept = new NioEventLoopGroup(); NioEventLoopGroup work = new NioEventLoopGroup(); ServerBootstrap server = new ServerBootstrap(); server.group(accept, work) // .option(ChannelOption.TCP_NODELAY, true) .childOption(ChannelOption.TCP_NODELAY, true) .channel(NioServerSocketChannel.class) .localAddress(9091) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { // TODO Auto-generated method stub ch.pipeline().addLast(new HttpServerCodec()); ch.pipeline().addLast(new serverHandler()); } }); server.bind().sync(); // TODO Auto-generated catch block accept.shutdownGracefully().sync(); work.shutdownGracefully().sync(); } }