public DefaultHttpClientConnector(ConnectionManager connectionManager, SenderConfiguration senderConfiguration, BootstrapConfiguration bootstrapConfig, EventLoopGroup clientEventGroup) { this.connectionManager = connectionManager; this.http2ConnectionManager = connectionManager.getHttp2ConnectionManager(); this.senderConfiguration = senderConfiguration; initTargetChannelProperties(senderConfiguration); if (Float.valueOf(senderConfiguration.getHttpVersion()) == Constants.HTTP_2_0) { isHttp2 = true; } this.clientEventGroup = clientEventGroup; this.bootstrapConfig = bootstrapConfig; }
private void initTargetChannelProperties(SenderConfiguration senderConfiguration) { this.httpVersion = senderConfiguration.getHttpVersion(); this.chunkConfig = senderConfiguration.getChunkingConfig(); this.socketIdleTimeout = senderConfiguration.getSocketIdleTimeout(Constants.ENDPOINT_TIMEOUT); this.sslConfig = senderConfiguration.getClientSSLConfig(); this.keepAliveConfig = senderConfiguration.getKeepAliveConfig(); this.forwardedExtensionConfig = senderConfiguration.getForwardedExtensionConfig(); }
public HttpClientChannelInitializer(SenderConfiguration senderConfiguration, HttpRoute httpRoute, ConnectionManager connectionManager, ConnectionAvailabilityFuture connectionAvailabilityFuture) { this.httpTraceLogEnabled = senderConfiguration.isHttpTraceLogEnabled(); this.keepAliveConfig = senderConfiguration.getKeepAliveConfig(); this.proxyServerConfiguration = senderConfiguration.getProxyServerConfiguration(); this.http2ConnectionManager = connectionManager.getHttp2ConnectionManager(); this.senderConfiguration = senderConfiguration; this.httpRoute = httpRoute; this.sslConfig = senderConfiguration.getClientSSLConfig(); this.connectionAvailabilityFuture = connectionAvailabilityFuture; String httpVersion = senderConfiguration.getHttpVersion(); if (Float.valueOf(httpVersion) == Constants.HTTP_2_0) { http2 = true; } connection = new DefaultHttp2Connection(false); clientFrameListener = new ClientFrameListener(); Http2FrameListener frameListener = new DelegatingDecompressorFrameListener(connection, clientFrameListener); Http2ConnectionHandlerBuilder connectionHandlerBuilder = new Http2ConnectionHandlerBuilder(); if (httpTraceLogEnabled) { connectionHandlerBuilder.frameLogger(new FrameLogger(TRACE, Constants.TRACE_LOG_UPSTREAM)); } http2ConnectionHandler = connectionHandlerBuilder.connection(connection).frameListener(frameListener).build(); http2TargetHandler = new Http2TargetHandler(connection, http2ConnectionHandler.encoder()); if (sslConfig != null) { sslHandlerFactory = new SSLHandlerFactory(sslConfig); } }