Code example for HttpsURLConnection

Methods: setHostnameVerifier

0
    query = addDelegationTokenParam(query);
    final URL url = new URL("https", nnAddr.getHostName(), 
        nnAddr.getPort(), path + '?' + query);
    HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
    // bypass hostname verification 
    conn.setHostnameVerifier(new DummyHostnameVerifier());
    return (HttpURLConnection)conn;
  } 
 
  @Override 
  public URI getUri() {
    try { 
      return new URI("hsftp", null, nnAddr.getHostName(), nnAddr.getPort(),
                     null, null, null); 
    } catch (URISyntaxException e) {
      return null; 
    }  
  } 
 
  /**