private TCLIService.Client getHttpClient() throws Exception {
    DefaultHttpClient httpClient = new DefaultHttpClient();

    Map<String, String> headers = new HashMap<>();
    headers.put("Connection", "close");
    httpClient.addRequestInterceptor(new BasicHttpRequestInterceptor(USERNAME, PASSWORD, null,
            null, false, headers));

    TTransport transport = new THttpClient(getHttpUrl(), httpClient);
    TProtocol protocol = new TBinaryProtocol(transport);
    return new TCLIService.Client(protocol);
  }
Test the connection metrics using an HttpClient, when HS2 is start in http mode.
itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHs2ConnectionMetricsHttp.java