public static void ensureReady(String fixtureName, String host, int port, int timeout) {
		long giveUpAt = System.currentTimeMillis() + timeout;
		while (System.currentTimeMillis() < giveUpAt) {
			try {
				new Socket(host, port);
				return;
			}
			catch (IOException e) {
				try {
					Thread.sleep(100);
				}
				catch (InterruptedException e1) {
					Thread.currentThread().interrupt();
					throw new IllegalStateException(e1);
				}
			}
		}
		throw new IllegalStateException(String.format(
				"Module [%s] does not seem to be listening after waiting for %dms", fixtureName, timeout));
	}
Verifies that the port to the broker is listening. If not throws an IllegalStateException.

@param fixtureName WThe module fixture is calling this method, used in case of exception
@param host the host to connect to
@param port the port to connect to
@param timeout The max time to try to get the connection to the broker in milliseconds

@throws IllegalStateException if can not connect in the specified timeout.
spring-xd-test-fixtures/src/main/java/org/springframework/xd/test/fixtures/util/AvailableSocketPorts.java