public class AvailableSocketPorts
extends java.lang.Object
Leverages SocketUtils.findAvailableServerSocket(int)
but in addition remembers
the allocated ports. This is because the port may not be used immediately after
it is found and thus may be re-allocated on subsequent calls.
Modifier and Type | Method and Description |
---|---|
static void |
ensureReady(java.lang.String fixtureName,
java.lang.String host,
int port,
int timeout)
Verifies that the port to the broker is listening.
|
static int |
nextAvailablePort() |
public static int nextAvailablePort()
public static void ensureReady(java.lang.String fixtureName, java.lang.String host, int port, int timeout)
fixtureName
- WThe module fixture is calling this method, used in case of exceptionhost
- the host to connect toport
- the port to connect totimeout
- The max time to try to get the connection to the broker in millisecondsjava.lang.IllegalStateException
- if can not connect in the specified timeout.