private InputStream getInputStream(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.");
    }

    HttpURLConnection connection = getHttpURLConnection(spec, requestMethod, headers, info);

    int responseCode = connection.getResponseCode();

    return responseCode >= ProxyService.HTTP_ERROR_RANGE_START ?
        connection.getErrorStream() : connection.getInputStream();
  }
Get an instance of HostPortRestrictionHandler

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