private String processResponse(HttpURLConnection connection) throws IOException {
    InputStream stream = connection.getInputStream();
    if (stream == null) {
      throw new IOException(handleUnexpectedStatusCode(
          connection, HttpStatus.SC_OK, "No input on successful API call"));
    }
    String jsonStr = IOUtils.toString(stream);
    try {
      JSONObject obj = new JSONObject(jsonStr);
      boolean result = obj.getBoolean("allowed");
      if (result) return null;
      String diag = obj.getString("diagnostics");
      return diag == null ? "" : diag;
    } catch (JSONException ex) {
      LOG.error("Couldn't parse " + jsonStr, ex);
      throw ex;
    }

  }
Checks yarn queue access of a given user for a given queue, and throws
HiveException in case the user doesn't have access to the queue.
@param  queueName the yarn queue name
@param  userName the username
@throws IOException when doAs throws an exception, we simply throw it
InterruptedException when doAs throws an exception, we simply throw it
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/YarnQueueHelper.java