title: how to bypass SSL authentication URL connection wise in java?
body: <p>I am creating a java application where I need to bypass SSL authentication  for <strong>some URL connection, not for all URL connection</strong>. Currently I am using the following code:</p>
  
  <pre><code>TrustManager[] trustAllCerts = new TrustManager[] {
      new X509TrustManager() {
          public java.security.cert.X509Certificate[] getAcceptedIssuers() {
              return null;
          }
          public void checkClientTrusted (
              java.security.cert.X509Certificate[] certs, String authType) {
          }
          public void checkServerTrusted (
              java.security.cert.X509Certificate[] certs, String authType) {
          }
      }
  };
  try {
      SSLContext sc = SSLContext.getInstance("SSL");
      sc.init(null, trustAllCerts, new java.security.SecureRandom());
      HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); 
  } catch (Exception e) {
  }
  </code></pre>
  
  <p>In this code all URL connection skipping SSL authentication, until the application get restarted. </p>
  
  <p>Is there any way so that we can skip SSL authentication check only for some URL connection, not for all URL connection?</p>