Package com.skava.orchestration.utils
Class NetworkUtil
java.lang.Object
com.skava.orchestration.utils.NetworkUtil
The Class NetworkUtil
This is network utility class- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkPortAvailablity
(String port) This method is used to check port availability.static String
Returns a free port number on localhost.
-
Constructor Details
-
NetworkUtil
public NetworkUtil()
-
-
Method Details
-
checkPortAvailablity
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
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
-