@Test
  public void testUnauthorizedConnection() throws Exception {
    String baseURL = "http://" + host + ":" + webUIPort + "/stacks";
    URL url = new URL(baseURL);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    Assert.assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, conn.getResponseCode());
  }
TestHS2HttpServerPam -- executes tests of HiveServer2 HTTP Server for Pam authentication
service/src/test/org/apache/hive/service/server/TestHS2HttpServerPam.java