public int port() {
    return socket.getLocalPort();
  }
A TCP server that accepts a client connection and closes it immediately.
testutils/src/java/org/apache/hive/testutils/junit/extensions/DoNothingTCPServer.java