public synchronized static SSLSocketFactory getTrustingSSLSocketFactory ( ) { if ( socketFactory != null ) return socketFactory ; TrustManager [ ] trustManagers = new TrustManager [ ] { new TrustEverythingSSLTrustManager ( ) } ; SSLContext sc ; try { sc = SSLContext . getInstance ( "SSL" ) ; sc . init ( null , trustManagers , null ) ; } catch ( GeneralSecurityException e ) { throw new RuntimeException ( "This is a BUG in Selenium; please report it" , e ) ; } socketFactory = sc . getSocketFactory ( ) ; return socketFactory ; }
Returns an SSLSocketFactory that will trust all SSL certificates ; this is suitable for passing to HttpsURLConnection either to its instance method setSSLSocketFactory or to its static method setDefaultSSLSocketFactory .