public int getFreePort() {
		try (ServerSocket socket = new ServerSocket(0)) {
			return socket.getLocalPort();
		} catch (IOException e) {
			noOp();
		}
		return -1;
	}
Returns a free port number on localhost, or -1 if unable to find a free port.

@return a free port number on localhost, or -1 if unable to find a free port
ngrinder-core/src/test/java/net/grinder/SingleConsoleTest.java