code: public static void ignoreAllCerts() {
          try {
              HttpsURLConnection.setDefaultSSLSocketFactory(TrustAllX509SocketFactory.getSSLSocketFactory());
              HttpsURLConnection.setDefaultHostnameVerifier(AllowAllHostnameVerifier.ALLOW_ALL_HOSTNAMES);
          } catch (Exception e) {
              throw new RuntimeException("Failed to set 'Trust all' default SSL SocketFactory and Hostname Verifier", e);
          }
      }
docs: Defines the HttpsURLConnection's default SSLSocketFactory and HostnameVerifier so that all subsequence HttpsURLConnection instances
  will trusts all certificates and accept all certificate hostnames.
  <p/>
  WARNING: Using this is dangerous as it bypasses most of what ssl certificates are made for. However, self-signed certificate, testing, and
  domains with multiple sub-domains will not fail handshake verification when this setting is applied.