public static Object clientCall(String jwt, URL url, String method, boolean json, Object arg) throws IOException {
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    try {
      if ("PATCH".equals(method)) {
        con.setRequestMethod("POST");
        con.setRequestProperty("X-HTTP-Method-Override", "PATCH");
      } else {
        con.setRequestMethod(method);
      }
      con.setRequestProperty(MetaStoreUtils.USER_NAME_HTTP_HEADER, url.getUserInfo());
      if (json) {
        con.setRequestProperty("Content-Type", "application/json");
      } else {
        con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
      }
      con.setRequestProperty("Accept", "application/json");
      if (jwt != null) {
        con.setRequestProperty("Authorization", "Bearer " + jwt);
      }
      con.setDoInput(true);
      if (arg != null) {
        con.setDoOutput(true);
        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
          if (json) {
            wr.writeBytes(serialize(arg));
          } else {
            wr.writeBytes(arg.toString());
          }
          wr.flush();
        }
      }
      // perform http method
      return httpResponse(con);
    } finally {
      con.disconnect();
    }
  }
Performs an http client call.
@param jwt a JWT bearer token (can be null)
@param url the url to call
@param method the http method to use
@param json whether the call is application/json (true) or application/x-www-form-urlencoded (false)
@param arg the query argument
@return the (JSON) response
@throws IOException
standalone-metastore/metastore-rest-catalog/src/test/java/org/apache/iceberg/rest/HMSTestBase.java