use of com.wavefront.agent.SSLConnectionSocketFactoryImpl in project java by wavefrontHQ.
the class APIContainer method createHttpEngine.
private ClientHttpEngine createHttpEngine() {
HttpClient httpClient = HttpClientBuilder.create().useSystemProperties().setUserAgent(proxyConfig.getHttpUserAgent()).setMaxConnTotal(proxyConfig.getHttpMaxConnTotal()).setMaxConnPerRoute(proxyConfig.getHttpMaxConnPerRoute()).setConnectionTimeToLive(1, TimeUnit.MINUTES).setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(proxyConfig.getHttpRequestTimeout()).build()).setSSLSocketFactory(new SSLConnectionSocketFactoryImpl(SSLConnectionSocketFactory.getSystemSocketFactory(), proxyConfig.getHttpRequestTimeout())).setRetryHandler(new DefaultHttpRequestRetryHandler(proxyConfig.getHttpAutoRetries(), true) {
@Override
protected boolean handleAsIdempotent(HttpRequest request) {
// by default, retry all http calls (submissions are idempotent).
return true;
}
}).setDefaultRequestConfig(RequestConfig.custom().setContentCompressionEnabled(true).setRedirectsEnabled(true).setConnectTimeout(proxyConfig.getHttpConnectTimeout()).setConnectionRequestTimeout(proxyConfig.getHttpConnectTimeout()).setSocketTimeout(proxyConfig.getHttpRequestTimeout()).build()).build();
final ApacheHttpClient4Engine httpEngine = new ApacheHttpClient4Engine(httpClient, true);
// avoid using disk at all
httpEngine.setFileUploadInMemoryThresholdLimit(100);
httpEngine.setFileUploadMemoryUnit(ApacheHttpClient4Engine.MemoryUnit.MB);
return httpEngine;
}
Aggregations