All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jangaroo.apprunner.proxy.HttpClientUtil Maven / Gradle / Ivy

There is a newer version: 4.1.17
Show newest version
package net.jangaroo.apprunner.proxy;

import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.ssl.SSLContextBuilder;

import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;

class HttpClientUtil {

  static SSLConnectionSocketFactory createSSLSocketFactory() {
    try {
      SSLContextBuilder sslContextBuilder = SSLContextBuilder.create()
              .loadTrustMaterial(null, new TrustSelfSignedStrategy());
      return new SSLConnectionSocketFactory(sslContextBuilder.build(), new DefaultHostnameVerifier());
    } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
      throw new IllegalStateException(e);
    }

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy