use of feign.okhttp.OkHttpClient in project atlasdb by palantir.
the class FeignOkHttpClients method newRawOkHttpClient.
@VisibleForTesting
static okhttp3.OkHttpClient newRawOkHttpClient(Optional<SSLSocketFactory> sslSocketFactory, Optional<ProxySelector> proxySelector, String userAgent) {
// Don't allow retrying on connection failures - see ticket #2194
okhttp3.OkHttpClient.Builder builder = new okhttp3.OkHttpClient.Builder().connectionSpecs(CONNECTION_SPEC_WITH_CYPHER_SUITES).connectionPool(new ConnectionPool(CONNECTION_POOL_SIZE, KEEP_ALIVE_TIME_MILLIS, TimeUnit.MILLISECONDS)).proxySelector(proxySelector.orElse(ProxySelector.getDefault())).retryOnConnectionFailure(false);
if (sslSocketFactory.isPresent()) {
builder.sslSocketFactory(sslSocketFactory.get());
}
builder.interceptors().add(new UserAgentAddingInterceptor(userAgent));
globalClientSettings.accept(builder);
return builder.build();
}
Aggregations