code: public static void trustAllSSLCertificates(HttpsURLConnection connection) {
          getTrustingSSLSocketFactory();
          connection.setSSLSocketFactory(socketFactory);
          connection.setHostnameVerifier(new HostnameVerifier() {
              public boolean verify(String s, SSLSession sslSession) {
                  return true;
              }
          });
      }
docs: Configures a single HttpsURLConnection to trust all SSL certificates.
  
  @param connection an HttpsURLConnection which will be configured to trust all certs