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(AbstractModuleFixture<?> fixture,
java.lang.String host,
int port,
int timeout)
Verifies that the port to the broker is available.
|
static int |
nextAvailablePort() |
public static int nextAvailablePort()
public static void ensureReady(AbstractModuleFixture<?> fixture, java.lang.String host, int port, int timeout)
fixture
- 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.