一.首先来看一段服务端的示例代码: public class NettyTestServer { public void bind(int port) throws Exception{ EventLoopGroup bossgroup = new NioEventLoopGroup();//创建BOSS线程组 EventLoopGroup workgroup = new NioEventLoopGroup();//创建WORK线程组 try{ ServerBootstrap b = new S…
Netty服务端启动代码: public final class EchoServer { static final int PORT = Integer.parseInt(System.getProperty("port", "8007")); public static void main(String[] args) throws Exception { // Configure the server. EventLoopGroup bossGroup = n…