@@ -0,0 +1,1585 @@
+package com.server;%0A%0Aimport io.netty.bootstrap.ServerBootstrap;%0Aimport io.netty.channel.Channel;%0Aimport io.netty.channel.ChannelOption;%0Aimport io.netty.channel.EventLoopGroup;%0Aimport io.netty.channel.nio.NioEventLoopGroup;%0Aimport io.netty.channel.socket.nio.NioServerSocketChannel;%0A%0A/**%0A * Created by form on 2017-07-20.%0A */%0Apublic class ServerMain %7B%0A    private int port;%0A%0A    public ServerMain(int port) %7B%0A        this.port = port;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        new ServerMain(80).run();%0A    %7D%0A%0A    public void run() %7B%0A        EventLoopGroup acceptor = new NioEventLoopGroup();%0A        EventLoopGroup worker = new NioEventLoopGroup();%0A        ServerBootstrap bootstrap = new ServerBootstrap();%0A        bootstrap.option(ChannelOption.SO_BACKLOG, 1024);%0A        //%E8%AE%BE%E7%BD%AE%E5%BE%AA%E7%8E%AF%E7%BA%BF%E7%A8%8B%E7%BB%84%EF%BC%8C%E5%89%8D%E8%80%85%E7%94%A8%E4%BA%8E%E5%A4%84%E7%90%86%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%BF%9E%E6%8E%A5%E4%BA%8B%E4%BB%B6%EF%BC%8C%E5%90%8E%E8%80%85%E7%94%A8%E4%BA%8E%E5%A4%84%E7%90%86%E7%BD%91%E7%BB%9CIO%0A        bootstrap.group(acceptor, worker);%0A        //%E7%94%A8%E4%BA%8E%E6%9E%84%E9%80%A0socketchannel%E5%B7%A5%E5%8E%82%0A        bootstrap.channel(NioServerSocketChannel.class);%0A        //%E4%B8%BA%E5%A4%84%E7%90%86accept%E5%AE%A2%E6%88%B7%E7%AB%AF%E7%9A%84channel%E4%B8%AD%E7%9A%84pipeline%E6%B7%BB%E5%8A%A0%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A4%84%E7%90%86%E5%87%BD%E6%95%B0%0A        bootstrap.childHandler(new ServerInitHandler());%0A        try %7B%0A            //%E7%BB%91%E5%AE%9A%E7%AB%AF%E5%8F%A3%EF%BC%88%E5%AE%9E%E9%99%85%E4%B8%8A%E6%98%AF%E5%88%9B%E5%BB%BAserversocketchannnel%EF%BC%8C%E5%B9%B6%E6%B3%A8%E5%86%8C%E5%88%B0eventloop%E4%B8%8A%EF%BC%89%EF%BC%8C%E5%90%8C%E6%AD%A5%E7%AD%89%E5%BE%85%E5%AE%8C%E6%88%90%EF%BC%8C%E8%BF%94%E5%9B%9E%E7%9B%B8%E5%BA%94channel%0A            Channel channel = bootstrap.bind(port).sync().channel();%0A            System.out.println(%22server strart running in port:%22 + port);%0A            //%E5%9C%A8%E8%BF%99%E9%87%8C%E9%98%BB%E5%A1%9E%EF%BC%8C%E7%AD%89%E5%BE%85%E5%85%B3%E9%97%AD%0A            channel.closeFuture().sync();%0A        %7D catch (InterruptedException e) %7B%0A            e.printStackTrace();%0A        %7D finally %7B%0A            //%E4%BC%98%E9%9B%85%E9%80%80%E5%87%BA%0A            acceptor.shutdownGracefully();%0A            worker.shutdownGracefully();%0A        %7D%0A    %7D%0A%7D%0A

Create ServerMain.java