title: java the host name doesn't match the certificate
body: <p>This is the exception that I'm having</p>
  
  <blockquote>
    <p>Host name 'bla bla bla.com' does not match the certificate subject provided by the peer (CN=*.bla bla bla.com, OU=PositiveSSL Wildcard, OU=Domain Control Validated)</p>
  </blockquote>
  
  <p>I already saw this question:</p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/19517538/ignoring-ssl-certificate-in-apache-httpclient-4-3">Ignoring SSL certificate in Apache HttpClient 4.3</a></p>
  </blockquote>
  
  <p>and I did as it suggests, but it didn't work. I have seen many question related to the problem but they are all deprecated.</p>
  
  <p>This is my code:</p>
  
  <pre><code>SSLContextBuilder builder = new SSLContextBuilder();
  builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
  SSLConnectionSocketFactory sslsf =
      new SSLConnectionSocketFactory(builder.build());
  CloseableHttpClient httpclient =
      HttpClients.custom().setSSLSocketFactory(sslsf).build();
  HttpGet httpGet = new HttpGet("https://b.blablabla.com");
  CloseableHttpResponse response1 = httpclient.execute(httpGet);
  try {
      System.out.println(response1.getStatusLine());
      HttpEntity entity1 = response1.getEntity();
      // do something useful with the response body
      // and ensure it is fully consumed
      EntityUtils.consume(entity1);
  } finally {
      response1.close();
  }
  </code></pre>
  
  <p>How can I bypass this certificate thing? <strong>This is just for testing; it is not a real production environment.</strong></p>