@Override
 protected void initChannel(final SocketChannel ch) throws Exception {
   ch.pipeline().addLast(new ObjectEncoder());
   ch.pipeline()
       .addLast(new ObjectDecoder(ClassResolvers.cacheDisabled(this.getClass().getClassLoader())));
   super.initChannel(ch);
 }
  @Override
  protected void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline p = ch.pipeline();

    // p.addLast(new LoggingHandler(LogLevel.INFO));
    p.addLast(new ObjectEncoder());
    p.addLast(new ObjectDecoder(ClassResolvers.cacheDisabled(null)));

    p.addLast(clientMtMapRequestAdapter);
  }
  // 新客户端建立连接,调用一次该方法
  @Override
  public void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline pipeline = ch.pipeline();
    /*
            pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
            pipeline.addLast("decoder", new StringDecoder());
            pipeline.addLast("encoder", new StringEncoder());
            pipeline.addLast("handler", new SimpleChatServerHandler());
    */
    // System.out.println("SimpleChatClient:" + ch.remoteAddress() + "连接上");

    pipeline.addLast(
        "decoder",
        new ObjectDecoder(ClassResolvers.cacheDisabled(this.getClass().getClassLoader())));
    pipeline.addLast("encoder", new ObjectEncoder());

    // 自己的逻辑Handler
    pipeline.addLast("handler", new SimpleChatServerHandler());
  }