@Test
  public void testSamlResponsePort() throws Exception {
    setupIDP(true, USER_PASS_MODE);
    for (int i=0; i<2; i++) {
      int samlResponsePort = MetaStoreTestUtils.findFreePort();
      try (TestHiveConnection connection = new TestHiveConnection(
          getSamlJdbcConnectionUrl(30, samlResponsePort), new Properties(), USER1,
          USER1_PASSWORD)) {
        assertLoggedInUser(connection, USER1);
        assertEquals(samlResponsePort,
            connection.getBrowserClient().getPort().intValue());
        break;
      }
    }
  }
Test makes sure that if a saml response port is provided on the URL, the browser
client opens the given port. We retry one more time in case of failure since the
the finding of free port has race conditions (port used immediately later by someone
else).
itests/hive-unit/src/test/java/org/apache/hive/service/auth/saml/TestHttpSamlAuthentication.java