public static SSLSocketFactory getSslSocketFactory ( ) { if ( ! sslDisabled ) { return SSLSocketFactory . getSocketFactory ( ) ; } try { final X509Certificate [ ] _AcceptedIssuers = new X509Certificate [ ] { } ; final SSLContext ctx = SSLContext . getInstance ( "TLS" ) ; final X509TrustManager tm = new X509TrustManager ( ) { @ Override public X509Certificate [ ] getAcceptedIssuers ( ) { return _AcceptedIssuers ; } @ Override public void checkServerTrusted ( final X509Certificate [ ] chain , final String authType ) throws CertificateException { } @ Override public void checkClientTrusted ( final X509Certificate [ ] chain , final String authType ) throws CertificateException { } } ; ctx . init ( null , new TrustManager [ ] { tm } , new SecureRandom ( ) ) ; return new SSLSocketFactory ( ctx , SSLSocketFactory . ALLOW_ALL_HOSTNAME_VERIFIER ) ; } catch ( final Throwable t ) { throw new RuntimeException ( t ) ; } }
Allow testing of features when we don t have any valid certs .