Source:
public HttpClient build() { OkHttpClient.Builder httpClientBuilder = this.okHttpClient == null ? new OkHttpClient.Builder() : this.okHttpClient.newBuilder(); for (Interceptor interceptor : this.networkInterceptors) { httpClientBuilder = httpClientBuilder.addNetworkInterceptor(interceptor); } httpClientBuilder = (this.readTimeout != null) ? httpClientBuilder.readTimeout(this.readTimeout) : httpClientBuilder.readTimeout(DEFAULT_READ_TIMEOUT); httpClientBuilder = (this.connectionTimeout != null) ? httpClientBuilder.connectTimeout(this.connectionTimeout) : httpClientBuilder.connectTimeout(DEFAULT_CONNECT_TIMEOUT); if (this.connectionPool != null) { httpClientBuilder = httpClientBuilder.connectionPool(connectionPool); } if (this.dispatcher != null) { httpClientBuilder = httpClientBuilder.dispatcher(dispatcher); } Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; ProxyOptions buildProxyOptions = (proxyOptions == null) ? ProxyOptions.loadFromConfiguration(buildConfiguration) : proxyOptions; if (buildProxyOptions != null) { httpClientBuilder = httpClientBuilder.proxySelector(new OkHttpProxySelector( mapProxyType(buildProxyOptions.getType(), logger), buildProxyOptions.getAddress(), buildProxyOptions.getNonProxyHosts())); if (proxyOptions.getUsername() != null) { String basicAuthorizationHeader = Credentials.basic(buildProxyOptions.getUsername(), buildProxyOptions.getPassword()); httpClientBuilder = httpClientBuilder.proxyAuthenticator((route, response) -> response.request().newBuilder() .header("Proxy-Authorization", basicAuthorizationHeader) .build()); } } return new OkHttpAsyncHttpClient(httpClientBuilder.build()); }

Target:
public HttpClient build() { OkHttpClient.Builder httpClientBuilder = this.okHttpClient == null ? new OkHttpClient.Builder() : this.okHttpClient.newBuilder(); for (Interceptor interceptor : this.networkInterceptors) { httpClientBuilder = httpClientBuilder.addNetworkInterceptor(interceptor); } httpClientBuilder = httpClientBuilder.readTimeout((readTimeout != null) ? readTimeout : DEFAULT_READ_TIMEOUT); httpClientBuilder = (this.connectionTimeout != null) ? httpClientBuilder.connectTimeout(this.connectionTimeout) : httpClientBuilder.connectTimeout(DEFAULT_CONNECT_TIMEOUT); if (this.connectionPool != null) { httpClientBuilder = httpClientBuilder.connectionPool(connectionPool); } if (this.dispatcher != null) { httpClientBuilder = httpClientBuilder.dispatcher(dispatcher); } Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; ProxyOptions buildProxyOptions = (proxyOptions == null) ? ProxyOptions.fromConfiguration(buildConfiguration) : proxyOptions; if (buildProxyOptions != null) { httpClientBuilder = httpClientBuilder.proxySelector(new OkHttpProxySelector( mapProxyType(buildProxyOptions.getType(), logger), buildProxyOptions.getAddress(), buildProxyOptions.getNonProxyHosts())); if (proxyOptions.getUsername() != null) { String basicAuthorizationHeader = Credentials.basic(buildProxyOptions.getUsername(), buildProxyOptions.getPassword()); httpClientBuilder = httpClientBuilder.proxyAuthenticator((route, response) -> response.request().newBuilder() .header("Proxy-Authorization", basicAuthorizationHeader) .build()); } } return new OkHttpAsyncHttpClient(httpClientBuilder.build()); }