private HttpURLConnection getHttpURLConnection(String spec, String requestMethod,
                                                 Map<String, String> headers, byte[] info)
      throws IOException {
    if (!isProxyCallAllowed(spec)) {
      LOG.warn("Call to " + spec + " is not allowed. See ambari.properties proxy.allowed.hostports.");
      throw new IOException("Call to " + spec + " is not allowed. See ambari.properties proxy.allowed.hostports.");
    }

    // adapt the headers to the internal URLStreamProvider processURL signature

    Map<String, List<String>> headerMap = new HashMap<>();
    for (Map.Entry<String, String> entry : headers.entrySet()) {
      headerMap.put(entry.getKey(), Collections.singletonList(entry.getValue()));
    }
    return streamProvider.processURL(spec, requestMethod, info, headerMap);
  }
Get an instance of HostPortRestrictionHandler

@return
ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java