private int findFreePort() throws IOException {
    ServerSocket socket= new ServerSocket(0);
    int port = socket.getLocalPort();
    socket.close();
    return port;
  }
Wait for metastore to have initialized token manager
This does not have to be done in other metastore test cases as they
use metastore client which will retry few times on failure
@throws InterruptedException
itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/metastore/security/TestHadoopAuthBridge23.java