public static int[] getRandomAvailableTCPPorts(int count) {
    return IntStream.generate(AvailablePortHelper::getRandomAvailableTCPPort)
        .limit(count)
        .toArray();
  }
Returns the requested number of available tcp ports.
geode-junit/src/main/java/org/apache/geode/internal/AvailablePortHelper.java