I am sure it will use SSLC by default. You can change this with SSLContext.setDefault ().
SSLContext c = SSLContext.getInstance("SSL"); TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); tmf.init(yourKeystore); TrustManager tm = tmf.getTrustManagers()[0]; tm. c.init(null, tm, null);
Here are some other values for the string parameters above.
If you need more control, you can implement your own subclass of SSLContext, which returns your own implementation of SSLSocketFactory and sets that SSLContext as the default value:
public class MySSLContext extends SSLContext { private SSLContext wrapped; private SSLSocketFactory mySocketFactory; public MySSLContext(SSLContext toWrap, SSLSocketFactory mySocketFactory) { wrapped = toWrap; this.mySocketFactory = mySocketFactory; } public SSLSocketFactory getSocketFactory() { return mySocketFactory; } public SSLSessionContext getClientSessionContext() { return wrapped; }
source share