use of org.apache.http.conn.ssl.DefaultHostnameVerifier in project scout.rt by eclipse.
the class ApacheHttpTransportFactory method getConfiguredConnectionManager.
/**
* Return the {@link HttpClientConnectionManager}. Return <code>null</code> to create it using the
* {@link HttpClientBuilder}. Caution: Returning a custom connection manager overrides several properties of the
* {@link HttpClientBuilder}.
*/
protected HttpClientConnectionManager getConfiguredConnectionManager() {
String[] sslProtocols = StringUtility.split(System.getProperty("https.protocols"), "\\s*,\\s*");
String[] sslCipherSuites = StringUtility.split(System.getProperty("https.cipherSuites"), "\\s*,\\s*");
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory((SSLSocketFactory) SSLSocketFactory.getDefault(), sslProtocols != null && sslProtocols.length > 0 ? sslProtocols : null, sslCipherSuites != null && sslCipherSuites.length > 0 ? sslCipherSuites : null, new DefaultHostnameVerifier(PublicSuffixMatcherLoader.getDefault()));
final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslConnectionSocketFactory).build(), null, null, null, CONFIG.getPropertyValue(ApacheHttpTransportConnectionTimeToLiveProperty.class), TimeUnit.MILLISECONDS);
connectionManager.setValidateAfterInactivity(1);
Integer maxTotal = CONFIG.getPropertyValue(ApacheHttpTransportMaxConnectionsTotalProperty.class);
if (maxTotal != null && maxTotal > 0) {
connectionManager.setMaxTotal(maxTotal);
}
Integer defaultMaxPerRoute = CONFIG.getPropertyValue(ApacheHttpTransportMaxConnectionsPerRouteProperty.class);
if (defaultMaxPerRoute > 0) {
connectionManager.setDefaultMaxPerRoute(defaultMaxPerRoute);
}
return connectionManager;
}
use of org.apache.http.conn.ssl.DefaultHostnameVerifier in project azure-tools-for-java by Microsoft.
the class SparkBatchSubmission method getSSLSocketFactory.
@Nullable
protected SSLConnectionSocketFactory getSSLSocketFactory() {
TrustStrategy ts = ServiceManager.getServiceProvider(TrustStrategy.class);
SSLConnectionSocketFactory sslSocketFactory = null;
if (ts != null) {
try {
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(ts).build();
sslSocketFactory = new SSLConnectionSocketFactory(sslContext, HttpObservable.isSSLCertificateValidationDisabled() ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier());
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
log().error("Prepare SSL Context for HTTPS failure. " + ExceptionUtils.getStackTrace(e));
}
}
return sslSocketFactory;
}
use of org.apache.http.conn.ssl.DefaultHostnameVerifier in project azure-tools-for-java by Microsoft.
the class HttpObservable method createSSLSocketFactory.
private SSLConnectionSocketFactory createSSLSocketFactory() {
TrustStrategy ts = ServiceManager.getServiceProvider(TrustStrategy.class);
SSLConnectionSocketFactory sslSocketFactory = null;
if (ts != null) {
try {
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(ts).build();
sslSocketFactory = new SSLConnectionSocketFactory(sslContext, HttpObservable.isSSLCertificateValidationDisabled() ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier());
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
log().error("Prepare SSL Context for HTTPS failure. " + ExceptionUtils.getStackTrace(e));
}
}
return sslSocketFactory;
}
Aggregations