Class LocalPortChecker


  • public class LocalPortChecker
    extends Object
    Utility to check port availability.
    • Constructor Detail

      • LocalPortChecker

        public LocalPortChecker()
    • Method Detail

      • isPortAvailable

        public boolean isPortAvailable​(int port)
        Check port availability.
        Parameters:
        port - the port to check on the local machine
        Returns:
        true if the port is available; false otherwise
      • findFirstOpenPortAbove

        public OptionalInt findFirstOpenPortAbove​(int port)
        Find the first open port above the given port (i.e. if port is 1024 then the first port to be checked will be 1025). If none are found return an empty OptionalInt
        Parameters:
        port - the port to check above
        Returns:
        an optional containing the first open port, or an empty optional