Source:
<code>public void before() throws Throwable { super.before(); Polling.awaitUnchecked(30, TimeUnit.SECONDS, new Callable<Boolean>() { @Override public Boolean call() throws Exception { final HostAndPort hap = deployment.address(); final SocketAddress address = new InetSocketAddress(hap.getHostText(), hap.getPort()); log.debug("attempting to connect to {}", address); try { final Socket s = new Socket(); s.connect(address, 100); log.info("successfully connected to address for {}", address, deployment); return true; } catch (SocketTimeoutException | ConnectException e) { log.debug("could not yet connect to HeliosDeployment: {}", e.toString()); return null; } } }); final HeliosClient client = client(); Polling.awaitUnchecked(30, TimeUnit.SECONDS, new Callable<Boolean>() { @Override public Boolean call() throws Exception { final ListenableFuture<List<String>> future = client.listHosts(); final List<String> hosts; try { hosts = future.get(1, TimeUnit.SECONDS); } catch (TimeoutException | InterruptedException e) { log.debug("timed out waiting for listHosts request to finish, will retry"); return null; } if (hosts.isEmpty()) { log.debug("0 agents in {}, will retry", deployment); return null; } <START> log.info("Ensured that at least one agent has registered with ZooKeeper in this" <END> + "HeliosDeployment. Now checking if it is UP."); final ListenableFuture<HostStatus> statusFuture = client.hostStatus(hosts.get(0)); final HostStatus hostStatus; try { hostStatus = statusFuture.get(1, TimeUnit.SECONDS); } catch (TimeoutException | InterruptedException e) { log.debug("timed out waiting for hostStatus request on host to finish, will retry", hosts.get(0)); return null; } if (hostStatus != null && hostStatus.getStatus() == HostStatus.Status.UP) { log.info("Ensured that at least one agent is UP in this HeliosDeployment, " + "continuing with test!"); return true; } return null; } }); }</code><technical_language>This log message a bit confusing, get rid of it. hard "agent registered ZooKeeper" means</technical_language>

Target:
public void before() throws Throwable { super.before(); Polling.awaitUnchecked(30, TimeUnit.SECONDS, new Callable<Boolean>() { @Override public Boolean call() throws Exception { final HostAndPort hap = deployment.address(); final SocketAddress address = new InetSocketAddress(hap.getHostText(), hap.getPort()); log.debug("attempting to connect to {}", address); try { final Socket s = new Socket(); s.connect(address, 100); log.info("successfully connected to address for {}", address, deployment); return true; } catch (SocketTimeoutException | ConnectException e) { log.debug("could not yet connect to HeliosDeployment: {}", e.toString()); return null; } } }); final HeliosClient client = client(); Polling.awaitUnchecked(30, TimeUnit.SECONDS, new Callable<Boolean>() { @Override public Boolean call() throws Exception { final ListenableFuture<List<String>> future = client.listHosts(); final List<String> hosts; try { hosts = future.get(1, TimeUnit.SECONDS); } catch (TimeoutException | InterruptedException e) { log.debug("timed out waiting for listHosts request to finish, will retry"); return null; } if (hosts.isEmpty()) { log.debug("0 agents in {}, will retry", deployment); return null; } final ListenableFuture<Map<String, HostStatus>> statusFuture = client.hostStatuses(hosts); final Map<String, HostStatus> hostStatuses; try { hostStatuses = statusFuture.get(1, TimeUnit.SECONDS); } catch (TimeoutException | InterruptedException e) { log.debug("timed out waiting for hostStatuses to finish, will retry"); return null; } for (final HostStatus hostStatus : hostStatuses.values()) { if (hostStatus != null && hostStatus.getStatus() == HostStatus.Status.UP) { log.info("Ensured that at least one agent is UP in this HeliosDeployment, " + "continuing with test!"); return true; } } return null; } }); }