private static boolean checkExactPortAvailability(InetAddress inetAddress, int port) {
		ServerSocket socket = null;
		try {
			if (inetAddress == null) {
				socket = new ServerSocket(port);
			} else {
				socket = new ServerSocket(port, 1, inetAddress);
			}
			return true;
		} catch (IOException e) {
			return false;
		} finally {
			if (socket != null) {
				try {
					socket.close();
				} catch (IOException e) {
					// FALL THROUGH
					noOp();
				}
			}
		}
	}
Check if the given port is available.

@param inetAddress address to be bound
@param port        port to be checked
@return true if available
ngrinder-core/src/main/java/net/grinder/util/NetworkUtils.java