code: @SuppressWarnings("deprecation")
    public static DefaultHttpClient getClientThatAllowAnyHTTPS(ThreadSafeClientConnManager cm) {
  
      final TrustManager easyTrustManager = new X509TrustManager() {
  
  
        public void checkClientTrusted(X509Certificate[] xcs, String string)
            throws CertificateException {}
  
        public void checkServerTrusted(X509Certificate[] xcs, String string)
            throws CertificateException {}
  
        public X509Certificate[] getAcceptedIssuers() {
          return null;
        }
      };
      final X509HostnameVerifier easyVerifier = new X509HostnameVerifier() {
  
        public boolean verify(String string, SSLSession ssls) {
          return true;
        }
  
        public void verify(String string, SSLSocket ssls) throws IOException {}
  
        public void verify(String string, String[] strings, String[] strings1) throws SSLException {}
  
        public void verify(String string, X509Certificate xc) throws SSLException {}
  
      };
  
      SSLContext ctx = null;
      try {
        ctx = SSLContext.getInstance("TLS");
        ctx.init(null, new TrustManager[] {easyTrustManager}, null);
      } catch (NoSuchAlgorithmException e) {
        throw new RuntimeException(e);
      } catch (KeyManagementException e) {
        throw new RuntimeException(e);
      }
  
      final SSLSocketFactory ssf = new SSLSocketFactory(ctx);
      ssf.setHostnameVerifier(easyVerifier);
      cm.getSchemeRegistry().register(new Scheme(HTTPS, ssf, HTTPS_PORT));
  
      return new DefaultHttpClient(cm);
  
  
    }
docs: Get a HttpClient that accept any HTTP certificate.
  
  @param cm the connection manager to use when creating the new HttpClient
  @return a httpClient that accept any HTTP certificate