Source:
<code>private ChannelPool newPool(SocketAddress address) { log.debugf("Creating new channel pool for %s", address); Bootstrap bootstrap = new Bootstrap() .group(eventLoopGroup) .channel(TransportHelper.socketChannel()) .remoteAddress(address) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, configuration.connectionTimeout()) .option(ChannelOption.SO_KEEPALIVE, configuration.tcpKeepAlive()) .option(ChannelOption.TCP_NODELAY, configuration.tcpNoDelay()) .option(ChannelOption.SO_RCVBUF, 1024576); int maxConnections = configuration.connectionPool().maxActive(); if (maxConnections < 0) { maxConnections = Integer.MAX_VALUE; } SslHandlerFactory sslHandlerFactoryForChannelInitializer = configuration.security().ssl().enabled() && !configuration.isSinglePort()? alloc -> SslHandlerHelper.createSslHandler(configuration, alloc) : null; <START> SslHandlerFactory sslHandlerFactoryForSinglePortAdapter = configuration.security().ssl().enabled() && configuration.isSinglePort() ? <END> alloc -> SslHandlerHelper.createSslHandler(configuration, alloc, "HR") : null; ChannelInitializer channelInitializer = new ChannelInitializer(bootstrap, address, operationsFactory, configuration, this, sslHandlerFactoryForChannelInitializer); if (configuration.isSinglePort()) { CustomProtocolUpgradeCodec hotRodUpgradeCodec = new CustomProtocolUpgradeCodec("HR", channelInitializer); SinglePortAdapter singlePortAdapter = new SinglePortAdapter(sslHandlerFactoryForSinglePortAdapter, hotRodUpgradeCodec); bootstrap.handler(singlePortAdapter); } else { bootstrap.handler(channelInitializer); } ChannelPool pool = new ChannelPool(bootstrap.config().group().next(), address, channelInitializer, configuration.connectionPool().exhaustedAction(), configuration.connectionPool().maxWait(), maxConnections, configuration.connectionPool().maxPendingRequests()); channelInitializer.setChannelPool(pool); return pool; }</code><technical_language>This code improved, a single check of isSinglePort do need there. current code checking this twice, in this lines shortly below, making more confusing read</technical_language>

Target:
private ChannelPool newPool(SocketAddress address) { log.debugf("Creating new channel pool for %s", address); Bootstrap bootstrap = new Bootstrap() .group(eventLoopGroup) .channel(TransportHelper.socketChannel()) .remoteAddress(address) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, configuration.connectionTimeout()) .option(ChannelOption.SO_KEEPALIVE, configuration.tcpKeepAlive()) .option(ChannelOption.TCP_NODELAY, configuration.tcpNoDelay()) .option(ChannelOption.SO_RCVBUF, 1024576); int maxConnections = configuration.connectionPool().maxActive(); if (maxConnections < 0) { maxConnections = Integer.MAX_VALUE; } SslHandlerFactory sslHandlerFactoryForChannelInitializer = null; SslHandlerFactory sslHandlerFactoryForSinglePortAdapter = null; if (configuration.security().ssl().enabled()) { if (isSinglePort()) { sslHandlerFactoryForSinglePortAdapter = alloc -> SslHandlerHelper.createSslHandler(configuration, alloc, "HR"); } else { sslHandlerFactoryForChannelInitializer = alloc -> SslHandlerHelper.createSslHandler(configuration, alloc); } } ChannelInitializer channelInitializer = new ChannelInitializer(bootstrap, address, operationsFactory, configuration, this, sslHandlerFactoryForChannelInitializer); if (isSinglePort()) { CustomProtocolUpgradeCodec hotRodUpgradeCodec = new CustomProtocolUpgradeCodec("HR", channelInitializer); SinglePortAdapter singlePortAdapter = new SinglePortAdapter(sslHandlerFactoryForSinglePortAdapter, hotRodUpgradeCodec); bootstrap.handler(singlePortAdapter); } else { bootstrap.handler(channelInitializer); } ChannelPool pool = new ChannelPool(bootstrap.config().group().next(), address, channelInitializer, configuration.connectionPool().exhaustedAction(), configuration.connectionPool().maxWait(), maxConnections, configuration.connectionPool().maxPendingRequests()); channelInitializer.setChannelPool(pool); return pool; }