Class NetworkUtil

java.lang.Object
com.skava.orchestration.utils.NetworkUtil

public class NetworkUtil extends Object

The Class NetworkUtil

This is network utility class
Author:
Infosys Equinox
  • Constructor Details

    • NetworkUtil

      public NetworkUtil()
  • Method Details

    • checkPortAvailablity

      public static boolean checkPortAvailablity(String port)
      This method is used to check port availability.
      Parameters:
      port - This parameter is used for passing the port number
      Returns:
      It returns boolean value
    • findFreePort

      public static String findFreePort()
      Returns a free port number on localhost. Heavily inspired from org.eclipse.jdt.launching.SocketUtil (to avoid a dependency to JDT just because of this). Slightly improved with close() missing in JDT. And throws exception instead of returning -1.
      Returns:
      a free port number on localhost
      Throws:
      IllegalStateException - if unable to find a free port