@Test
  public void testServletEchoB() throws Exception {
    HttpClient client = HttpClients.createDefault();
    HttpResponse response = null;
    try {
      String jwt = generateJWT();
      String msgBody = "{\"method\":\"echo\"}";
      HttpPost post = createPost(jwt, msgBody);

      response = client.execute(post);
      Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode());
      String resp = null;
      HttpEntity entity = response.getEntity();
      if (entity != null) {
        ContentType contentType = ContentType.getOrDefault(entity);
        Charset charset = contentType.getCharset();
        Reader reader = new InputStreamReader(entity.getContent(), charset);
        resp = readString(reader);
      }
      Assert.assertNotNull(resp);
      Assert.assertEquals(msgBody, resp);
    } finally {
      if (response instanceof AutoCloseable) {
        ((AutoCloseable) response).close();
      }
      if (client instanceof AutoCloseable) {
        ((AutoCloseable) client).close();
      }
    }
  }
A property client that uses http as transport.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/properties/HMSServletTest.java