private static void waitForAdminServer(String url) throws InterruptedException, IllegalStateException {
		boolean connected = false;
		Exception exception = null;
		int httpStatus = 0;
		long expiry = System.currentTimeMillis() + 30000;
		CloseableHttpClient httpClient = HttpClientBuilder.create().build();

		try {
			do {
				try {
					Thread.sleep(100);

					HttpGet httpGet = new HttpGet(url);
					httpStatus = httpClient.execute(httpGet).getStatusLine().getStatusCode();
					if (httpStatus == HttpStatus.SC_OK) {
						connected = true;
					}
				}
				catch (IOException e) {
					exception = e;
				}
			}
			while ((!connected) && System.currentTimeMillis() < expiry);
		}
		finally {
			try {
				httpClient.close();
			}
			catch (IOException e) {
				// ignore exception on close
			}
		}

		if (!connected) {
			StringBuilder builder = new StringBuilder();
			builder.append("Failed to connect to '").append(url).append("'");
			if (httpStatus > 0) {
				builder.append("; last HTTP status: ").append(httpStatus);
			}
			if (exception != null) {
				StringWriter writer = new StringWriter();
				exception.printStackTrace(new PrintWriter(writer));
				builder.append("; exception: ")
						.append(exception.toString())
						.append(", ").append(writer.toString());
			}
			throw new IllegalStateException(builder.toString());
		}
	}
Block the executing thread until the admin server is responding to
HTTP requests.

@param url URL for admin server
@throws InterruptedException            if the executing thread is interrupted
@throws java.lang.IllegalStateException if a successful connection to the
        admin server was not established
spring-xd-distributed-test/src/main/java/org/springframework/xd/distributed/util/ServerProcessUtils.java