@Override
public void configure(Channel channel, HttpHandler httpPipeline) {
sslContext.ifPresent(ssl -> {
SslHandler sslHandler = ssl.newHandler(channel.alloc());
channel.pipeline().addLast(sslHandler);
});
channel.pipeline()
.addLast("connection-throttler", excessConnectionRejector)
.addLast("channel-activity-event-constrainer", new ChannelActivityEventConstrainer())
.addLast("idle-handler", new IdleStateHandler(serverConfig.requestTimeoutMillis(), 0, serverConfig.keepAliveTimeoutMillis(), MILLISECONDS))
.addLast("channel-stats", channelStatsHandler)
.addLast("http-server-codec", new HttpServerCodec(serverConfig.maxInitialLineLength(), serverConfig.maxHeaderSize(), serverConfig.maxChunkSize(), true))
.addLast("timeout-handler", new RequestTimeoutHandler())
.addLast("keep-alive-handler", new IdleTransactionConnectionCloser(metrics))
.addLast("server-protocol-distribution-recorder", new ServerProtocolDistributionRecorder(metrics, sslContext.isPresent()))
.addLast("styx-decoder", requestTranslator())
.addLast("proxy", new HttpPipelineHandler.Builder(httpPipeline)
.responseEnhancer(responseEnhancer)
.errorStatusListener(httpErrorStatusListener)
.progressListener(requestStatsCollector)
.metricRegistry(metrics)
.secure(sslContext.isPresent())
.requestTracker(requestTracker)
.build());
}