@Override
            protected boolean isPortAvailable(int port) {
                try {
                    ServerSocket serverSocket = ServerSocketFactory.getDefault().createServerSocket(
                            port, 1, InetAddress.getByName("localhost"));
                    serverSocket.close();
                    return true;
                } catch (Exception ex) {
                    return false;
                }
            }
Find the requested number of available UDP ports, 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 UDP port numbers
@throws IllegalStateException if the requested number of available ports could not be found
grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/SocketUtils.java