nl.altindag.sslcontext.util.ApacheSslContextUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sslcontext-kickstart-for-apache Show documentation
Show all versions of sslcontext-kickstart-for-apache Show documentation
High level library to configure a SSLContext and other properties to enable SSL/TLS connection
package nl.altindag.sslcontext.util;
import nl.altindag.sslcontext.SSLFactory;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import java.util.Objects;
public final class ApacheSslContextUtils {
private ApacheSslContextUtils() {}
public static LayeredConnectionSocketFactory toLayeredConnectionSocketFactory(SSLFactory sslFactory) {
Objects.requireNonNull(sslFactory.getSslContext());
return new SSLConnectionSocketFactory(
sslFactory.getSslContext(),
sslFactory.getSslContext().getSupportedSSLParameters().getProtocols(),
sslFactory.getSslContext().getSupportedSSLParameters().getCipherSuites(),
sslFactory.getHostnameVerifier()
);
}
}