class WsServer implements ServerLifecycle {
    ChannelFuture _server;
    WebSocketServerProps _props;

    private ServerSslProps sslProps;
    private SSLContext sslContext;

    protected boolean supportSsl() {
        if (sslProps == null) {
            sslProps = ServerSslProps.of(ServerConstants.SIGNAL_WEBSOCKET);
        }

        return sslProps.isEnable() && sslProps.getSslKeyStore() != null;
    }

    public WsServer(WebSocketServerProps props){
        _props = props;
    }

    @Override
    public void start(String host, int port) throws Throwable {
        EventLoopGroup bossGroup = new NioEventLoopGroup(_props.getCoreThreads());
        EventLoopGroup workGroup = new NioEventLoopGroup(_props.getMaxThreads(false));

        try {
            if(supportSsl()){
                sslContext = SslContextFactory.create(sslProps);
            }

            ServerBootstrap bootstrap = new ServerBootstrap();
            bootstrap.group(bossGroup, workGroup)
                    .channel(NioServerSocketChannel.class)
                    .childHandler(new ChannelInitializer<SocketChannel>() {
                        @Override
                        public void initChannel(SocketChannel ch) throws Exception {<FILL_FUNCTION_BODY>}
                    });
            if (Utils.isEmpty(host)) {
                _server = bootstrap.bind(port).await();
            } else {
                _server = bootstrap.bind(host, port).await();
            }
        } catch (RuntimeException e) {
            bossGroup.shutdownGracefully();
            workGroup.shutdownGracefully();

            throw e;
        } catch (Throwable e) {
            bossGroup.shutdownGracefully();
            workGroup.shutdownGracefully();

            throw new IllegalStateException(e);
        }
    }

    @Override
    public void stop() throws Throwable {
        if (_server == null) {
            return;
        }

        _server.channel().close();
        _server = null;
    }
}

                            ChannelPipeline pipeline = ch.pipeline();

                            if(sslContext != null) {
                                SSLEngine engine = sslContext.createSSLEngine();
                                engine.setUseClientMode(false);
                                engine.setNeedClientAuth(true);
                                pipeline.addFirst(new SslHandler(engine));
                            }

                            //将请求和应答消息编码或解码为HTTP消息
                            pipeline.addLast(new HttpServerCodec());
                            //将HTTP消息的多个部分组合成一条完整的HTTP消息
                            pipeline.addLast(new HttpObjectAggregator(65536));
                            //向客户端发送HTML5文件，主要用于支持浏览器和服务端进行WebSocket通信
                            pipeline.addLast(new ChunkedWriteHandler());
                            pipeline.addLast(new WsServerHandler());
                        
<no_super_class>