use of org.apache.http.nio.conn.ssl.SSLIOSessionStrategy in project drill by apache.
the class WebUtils method createHttpClient.
private static CloseableHttpAsyncClient createHttpClient(DrillConfig drillConfig) throws Exception {
HttpAsyncClientBuilder clientBuilder = HttpAsyncClients.custom();
if (drillConfig.getBoolean(ExecConstants.HTTP_ENABLE_SSL)) {
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(new TrustSelfSignedStrategy()).build();
SSLIOSessionStrategy sessionStrategy = new SSLIOSessionStrategy(sslContext, new String[] { drillConfig.getString(ExecConstants.SSL_PROTOCOL) }, null, SSLIOSessionStrategy.getDefaultHostnameVerifier());
clientBuilder.setSSLStrategy(sessionStrategy);
}
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(drillConfig.getInt(ExecConstants.HTTP_CLIENT_TIMEOUT)).build();
clientBuilder.setDefaultRequestConfig(requestConfig);
return clientBuilder.build();
}
Aggregations