@Test
  public void testTrustedDomainAuthentication() throws Exception {
    String port = "10000";
    String urlExtra = "";
    if (hs2TransportMode.equals(HS2_TRANSPORT_MODE_HTTP)) {
      port = "10001";
      urlExtra = ";transportMode=http;httpPath=cliservice";
    }

    String url = "jdbc:hive2://localhost:" + port + "/default" + urlExtra;
    Class.forName("org.apache.hive.jdbc.HiveDriver");

    if (properTrustedDomain) {
      testProperTrustedDomainAuthentication(url);
    } else {
      testImproperTrustedDomainAuthentication(url);
    }
  }
An abstract implementation of TrustDomainAuthentication Test.
itests/hive-unit/src/test/java/org/apache/hive/service/auth/TrustDomainAuthenticationTest.java