Source:
public NettyServerTransport( final ThriftServerDef def, final NettyServerConfig nettyServerConfig, final ChannelGroup allChannels) { this.def = def; this.nettyServerConfig = nettyServerConfig; this.requestedPort = def.getServerPort(); this.allChannels = allChannels; final ConnectionLimiter connectionLimiter = new ConnectionLimiter(def.getMaxConnections()); this.channelStatistics = new ChannelStatistics(allChannels); this.sslConfiguration = new AtomicReference<SSLServerConfiguration>(); this.sslConfiguration.set(this.def.getSslConfiguration()); this.pipelineFactory = new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline cp = Channels.pipeline(); TProtocolFactory inputProtocolFactory = def.getDuplexProtocolFactory().getInputProtocolFactory(); NiftySecurityHandlers securityHandlers = def.getSecurityFactory().getSecurityHandlers(def, nettyServerConfig); cp.addLast("connectionContext", new ConnectionContextHandler()); cp.addLast("connectionLimiter", connectionLimiter); cp.addLast(ChannelStatistics.NAME, channelStatistics); cp.addLast("encryptionHandler", securityHandlers.getEncryptionHandler()); cp.addLast("frameCodec", def.getThriftFrameCodecFactory().create(def.getMaxFrameSize(), inputProtocolFactory)); if (def.getClientIdleTimeout() != null) { cp.addLast("idleTimeoutHandler", new IdleStateHandler(nettyServerConfig.getTimer(), def.getClientIdleTimeout().toMillis(), NO_WRITER_IDLE_TIMEOUT, NO_ALL_IDLE_TIMEOUT, TimeUnit.MILLISECONDS)); cp.addLast("idleDisconnectHandler", new IdleDisconnectHandler()); } cp.addLast("authHandler", securityHandlers.getAuthenticationHandler()); cp.addLast("dispatcher", new NiftyDispatcher(def, nettyServerConfig.getTimer())); cp.addLast("exceptionLogger", new NiftyExceptionLogger()); SSLServerConfiguration serverConfiguration = sslConfiguration.get(); if (serverConfiguration != null) { SslHandler handler = serverConfiguration.createHandler(); if (serverConfiguration.allowPlaintext) { cp.addFirst("ssl_plaintext", new SSLPlaintextHandler(handler, "ssl")); } else { cp.addFirst("ssl", handler); } } return cp; } }; }

Target:
public NettyServerTransport( final ThriftServerDef def, final NettyServerConfig nettyServerConfig, final ChannelGroup allChannels) { this.def = def; this.nettyServerConfig = nettyServerConfig; this.requestedPort = def.getServerPort(); this.allChannels = allChannels; final ConnectionLimiter connectionLimiter = new ConnectionLimiter(def.getMaxConnections()); this.channelStatistics = new ChannelStatistics(allChannels); this.sslConfiguration.set(this.def.getSslConfiguration()); this.pipelineFactory = new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline cp = Channels.pipeline(); TProtocolFactory inputProtocolFactory = def.getDuplexProtocolFactory().getInputProtocolFactory(); NiftySecurityHandlers securityHandlers = def.getSecurityFactory().getSecurityHandlers(def, nettyServerConfig); cp.addLast("connectionContext", new ConnectionContextHandler()); cp.addLast("connectionLimiter", connectionLimiter); cp.addLast(ChannelStatistics.NAME, channelStatistics); cp.addLast("encryptionHandler", securityHandlers.getEncryptionHandler()); cp.addLast("frameCodec", def.getThriftFrameCodecFactory().create(def.getMaxFrameSize(), inputProtocolFactory)); if (def.getClientIdleTimeout() != null) { cp.addLast("idleTimeoutHandler", new IdleStateHandler(nettyServerConfig.getTimer(), def.getClientIdleTimeout().toMillis(), NO_WRITER_IDLE_TIMEOUT, NO_ALL_IDLE_TIMEOUT, TimeUnit.MILLISECONDS)); cp.addLast("idleDisconnectHandler", new IdleDisconnectHandler()); } cp.addLast("authHandler", securityHandlers.getAuthenticationHandler()); cp.addLast("dispatcher", new NiftyDispatcher(def, nettyServerConfig.getTimer())); cp.addLast("exceptionLogger", new NiftyExceptionLogger()); SslServerConfiguration serverConfiguration = sslConfiguration.get(); if (serverConfiguration != null) { SslHandler handler = serverConfiguration.createHandler(); if (serverConfiguration.allowPlaintext) { cp.addFirst("ssl_plaintext", new SslPlaintextHandler(handler, "ssl")); } else { cp.addFirst("ssl", handler); } } return cp; } }; }