code: private static void disableSSLCertificateChecking() {
          TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
              public X509Certificate[] getAcceptedIssuers() {
                  return null;
              }
  
              @Override
              public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
                  // Not implemented
              }
  
              @Override
              public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
                  // Not implemented
              }
          } };
  
          try {
              SSLContext sc = SSLContext.getInstance("TLS");
              sc.init(null, trustAllCerts, new java.security.SecureRandom());
  
              HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
  
              // Create all-trusting host name verifier
              HostnameVerifier allHostsValid = new HostnameVerifier() {
                  public boolean verify(String hostname, SSLSession session) {
                      return true;
                  }
              };
  
              // Install the all-trusting host verifier
              HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
          } catch (KeyManagementException e) {
              throw new IllegalArgumentException("Disabling SSL certificate failed: " + e,e);
          } catch (NoSuchAlgorithmException e) {
              throw new IllegalArgumentException("Disabling SSL certificate failed: " + e,e);
          }
      }
docs: ============================================================================================