package com.xqbase.gatekeeper.tcp.netty;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

/**
 * This custom channel initializer adds our self channel handlers
 * to the channel pipeline.
 *
 * @author Tony He
 */
@ChannelHandler.Sharable
public class CustomServerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {

    }
}

@@ -147,28 +147,213 @@
 nel.
-socket.SocketChannel
+ChannelPipeline;%0Aimport io.netty.channel.socket.SocketChannel;%0Aimport io.netty.handler.timeout.ReadTimeoutHandler;%0Aimport io.netty.handler.timeout.WriteTimeoutHandler;%0A%0Aimport java.util.concurrent.TimeUnit
 ;%0A%0A/
@@ -590,86 +590,541 @@
     
-@Override%0A    protected void initChannel(SocketChannel ch) throws Exception %7B%0A
+private int readTimeout = 1500;%0A    private int writeTimeout = 1500;%0A%0A    private final TcpServerHandler serverHandler;%0A%0A    public CustomServerInitializer() %7B%0A        serverHandler = new TcpServerHandler();%0A    %7D%0A%0A    @Override%0A    protected void initChannel(SocketChannel ch) throws Exception %7B%0A        ChannelPipeline p = ch.pipeline();%0A        p.addLast(new ReadTimeoutHandler(readTimeout, TimeUnit.MILLISECONDS));%0A        p.addLast(new WriteTimeoutHandler(writeTimeout, TimeUnit.MILLISECONDS));%0A        p.addLast(serverHandler);
 %0A   

add channel initializer...