private void testProperTrustedDomainAuthentication(String url) throws SQLException {
    // When the connection is from a trusted domain any connection is authentic irrespective of
    // user and password
    Connection connection = DriverManager.getConnection(url, correctUser, correctPassword);
    connection.close();

    connection = DriverManager.getConnection(url, wrongUser, correctPassword);
    connection.close();

    connection = DriverManager.getConnection(url, wrongUser, wrongPassword);
    connection.close();

    connection = DriverManager.getConnection(url, correctUser, wrongPassword);
    connection.close();
  }
An abstract implementation of TrustDomainAuthentication Test.
itests/hive-unit/src/test/java/org/apache/hive/service/auth/TrustDomainAuthenticationTest.java