SortedSet<Integer> findAvailablePorts(int numRequested, int minPort, int maxPort) {
            isTrue(minPort > 0, "'minPort' must be greater than 0");
            isTrue(maxPort > minPort, "'maxPort' must be greater than 'minPort'");
            isTrue(maxPort <= PORT_RANGE_MAX, "'maxPort' must be less than or equal to " + PORT_RANGE_MAX);
            isTrue(numRequested > 0, "'numRequested' must be greater than 0");
            isTrue((maxPort - minPort) >= numRequested,
                    "'numRequested' must not be greater than 'maxPort' - 'minPort'");

            final SortedSet<Integer> availablePorts = new TreeSet<>();
            int attemptCount = 0;
            while ((++attemptCount <= numRequested + 100) && (availablePorts.size() < numRequested)) {
                availablePorts.add(findAvailablePort(minPort, maxPort));
            }

            if (availablePorts.size() != numRequested) {
                throw new IllegalStateException(String.format(
                        "Could not find %d available %s ports in the range [%d, %d]", numRequested, name(), minPort,
                        maxPort));
            }

            return availablePorts;
        }
Find the requested number of available ports for this {@code SocketType},
each randomly selected from the range [{@code minPort}, {@code maxPort}].
@param numRequested the number of available ports to find
@param minPort the minimum port number
@param maxPort the maximum port number
@return a sorted set of available port numbers for this socket type
@throws IllegalStateException if the requested number of available ports could not be found
agent-module/plugins-test-module/testcase/src/main/java/com/navercorp/pinpoint/testcase/util/SocketUtils.java