code: private SSLContext getSSLContext() throws NoSuchAlgorithmException, KeyManagementException {
          SSLContext sslContext = SSLContext.getInstance("SSL");
          sslContext.init(null, new TrustManager[] {
              new X509TrustManager() {
                  @Override
                  public void checkClientTrusted(X509Certificate[] certs, String authType) {
                      // nop
                  }
  
                  @Override
                  public void checkServerTrusted(X509Certificate[] certs, String authType) {
                      // nop
                  }
  
                  @Override
                  public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                      return null;
                  }
              }
          }, new java.security.SecureRandom());
          return sslContext;
      }
docs: This SSLContext is used only when the protocol is HTTPS AND a trusted hosts list has been provided. In that case,
  this SSLContext accepts all certificates, whether they are expired or not, and regardless of the CA that issued
  them.
  
  @return An SSL context that does not validate certificates
  @throws NoSuchAlgorithmException
  @throws KeyManagementException