private Channel pollAndVerifyCachedChannel(Request request, ProxyServer proxy, AsyncHandler<?> asyncHandler) { if (asyncHandler instanceof AsyncHandlerExtensions) AsyncHandlerExtensions.class.cast(asyncHandler).onConnectionPool(); Uri uri = request.getUri(); String virtualHost = request.getVirtualHost(); final Channel channel = channelManager.poll(uri, virtualHost, proxy, request.getConnectionPoolPartitioning()); if (channel != null) { LOGGER.debug("Using cached Channel {}\n for uri {}\n", channel, uri); try { channelManager.verifyChannelPipeline(channel.pipeline(), uri, virtualHost); } catch (Exception ex) { LOGGER.debug(ex.getMessage(), ex); } } return channel; }
public Channel pollAndVerifyCachedChannel(Request request, ProxyServer proxy, AsyncHandler<?> asyncHandler) { if (asyncHandler instanceof AsyncHandlerExtensions) AsyncHandlerExtensions.class.cast(asyncHandler).onConnectionPool(); Uri uri = request.getUri(); String virtualHost = request.getVirtualHost(); final Channel channel = channelManager.poll(uri, virtualHost, proxy, request.getConnectionPoolPartitioning()); if (channel != null) { LOGGER.debug("Using cached Channel {}\n for uri {}\n", channel, uri); try { // Always make sure the channel who got cached support the // proper protocol. It could // only occurs when a HttpMethod.CONNECT is used against a proxy // that requires upgrading from http to // https. channelManager.verifyChannelPipeline(channel.getPipeline(), uri, virtualHost); } catch (Exception ex) { LOGGER.debug(ex.getMessage(), ex); } } return channel; }