public class NetworkUtil extends Object
| Constructor and Description |
|---|
NetworkUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
findAvailablePort(String hostname,
int startPort,
int endPort)
Finds an available port within a port range on a host
|
static void |
waitUntilPortListening(String hostname,
int port,
int timeout)
Waits until a port is listening on a given host.
|
public static int findAvailablePort(String hostname, int startPort, int endPort)
hostname - Host namestartPort - Port number starting the rangeendPort - Port number ending the rangepublic static void waitUntilPortListening(String hostname, int port, int timeout) throws IOException
hostname - Host nameport - Port numbertimeout - Timeout in secondsIOException - If a connection error occurs or if the timeout is exceededCopyright © 2016. All Rights Reserved.