@Override
  protected void initChannel(SocketChannel ch) throws Exception {
    // To honor http2 window size, WriteBufferWaterMark.high() should be greater or equal to http2 window size.
    // Also see: https://github.com/netty/netty/issues/10193
    // https://stackoverflow.com/questions/25281124/netty-4-high-and-low-write-watermarks
    ch.config()
        .setSendBufferSize(http2ClientConfig.nettySendBufferSize)
        .setReceiveBufferSize(http2ClientConfig.nettyReceiveBufferSize)
        .setWriteBufferWaterMark(new WriteBufferWaterMark(http2ClientConfig.http2InitialWindowSize / 2,
            http2ClientConfig.http2InitialWindowSize));
    // If channel handler implementations are not annotated with @Sharable, Netty creates a new instance of every class
    // in the pipeline for every connection.
    // i.e. if there are a 1000 active connections there will be a 1000 NettyMessageProcessor instances.
    ChannelPipeline pipeline = ch.pipeline();
    // connection stats handler to track connection related metrics
    pipeline.addLast("ConnectionStatsHandler", connectionStatsHandler);
    InetSocketAddress peerAddress = ch.remoteAddress();
    String peerHost = peerAddress.getHostName();
    int peerPort = peerAddress.getPort();
    SslHandler sslHandler = new SslHandler(sslFactory.createSSLEngine(peerHost, peerPort, SSLFactory.Mode.SERVER));
    pipeline.addLast("SslHandler", sslHandler);
    pipeline.addLast("SecurityChecker", serverSecurityHandler);
    pipeline.addLast("Http2FrameCodec", Http2FrameCodecBuilder.forServer()
        .initialSettings(Http2Settings.defaultSettings()
            .maxFrameSize(http2ClientConfig.http2FrameMaxSize)
            .initialWindowSize(http2ClientConfig.http2InitialWindowSize))
        .frameLogger(new Http2FrameLogger(LogLevel.DEBUG, "server"))
        .build());
    pipeline.addLast("Http2MultiplexHandler", new Http2MultiplexHandler(http2ServerStreamHandler));
    pipeline.addLast("CloseOnExceptionHandler", new CloseOnExceptionHandler());
  }
Construct a {@link StorageServerNettyChannelInitializer}.
@param http2ClientConfig configs that http2 client used.
@param http2ServerMetrics http2ServerMetrics
@param sslFactory the {@link SSLFactory} to use for generating {@link javax.net.ssl.SSLEngine} instances.
@param connectionStatsHandler handler to stats connections.
@param http2ServerStreamHandler handler initializer for http2 stream channel.
@param serverSecurityHandler security validation handler for new HTTP2 connection.
ambry-rest/src/main/java/com/github/ambry/rest/StorageServerNettyChannelInitializer.java