title: Connect to a HTTPS secure website and ping the latency
body: <p>My code currently tries to ping a URL the user provide. It works fine with non-HTTPS websites. But if I try with something like: <a href="https://www.httpsnow.org/" rel="nofollow">https://www.httpsnow.org/</a> I get an exception: <code>Could not establish connection. Error is: 'sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target'</code></p>
  
  <p>Code below:</p>
  
  <pre><code>try
     {
     long startTime = DateProvider.getCurrentTimeMillis();
  
     huc = getConnection(url);
     huc.setRequestMethod("GET");
     huc.setConnectTimeout(10000);
     huc.connect();
  
     long endTime = DateProvider.getCurrentTimeMillis();
     long processingTime = (endTime - startTime);
     value = Long.toString(processingTime);
  
  catch (IOException ioe)
    {
    processFailure("Could not establish connection. Error is: '" + ioe.getLocalizedMessage() + "'.");
     }
  </code></pre>
  
  <p>What can I do to bypass the cert not being found code-wise? </p>
  
  <p>Edit: I have looked at the solutions provided in the other thread. Implementation a TrustManager can open up to MITM attacks. But since I am only pinging the server, would that really affect me at all? </p>