Class AvailablePort

java.lang.Object
org.apache.camel.test.AvailablePort

public class AvailablePort extends Object
  • Constructor Details

    • AvailablePort

      public AvailablePort()
  • Method Details

    • probePort

      public static int probePort(InetAddress address, int port)
      Probe a port to see if it is free
      Parameters:
      port - an integer port number to be tested. If port is 0, then the next available port is returned.
      Returns:
      the port number itself if the port is free or, in case of port 0, the first available port number.
      Throws:
      IllegalStateException - if the port is not free or, in case of port 0, if there are no ports available at all.