private static void _trustAllHttpsCertificates(){
  SSLContext context;
  if (_trustManagers == null) {
    _trustManagers=new TrustManager[]{new FakeX509TrustManager()};
  }
  try {
    context=SSLContext.getInstance("SSL");
    context.init(null,_trustManagers,new SecureRandom());
  }
 catch (  GeneralSecurityException gse) {
    throw new IllegalStateException(gse.getMessage());
  }
  HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
}

private static void _trustAllHttpsCertificates ( ) { SSLContext context ; if ( _trustManagers == null ) { _trustManagers = new TrustManager [ ] { new FakeX509TrustManager ( ) } ; } try { context = SSLContext . getInstance ( "SSL" ) ; context . init ( null , _trustManagers , new SecureRandom ( ) ) ; } catch ( GeneralSecurityException gse ) { throw new IllegalStateException ( gse . getMessage ( ) ) ; } HttpsURLConnection . setDefaultSSLSocketFactory ( context . getSocketFactory ( ) ) ; }
set the default x509 trust manager to an instance of a fake class that trust all certificates , even the self - signed ones .
