Source:
<code>public void test() throws Exception { final String syslogOutput = "should-be-redirected"; try (final DockerClient docker = getNewDockerClient()) { final String port = "4711"; final String expose = port + "/udp"; final ContainerConfig config = ContainerConfig.builder() .image("uggedal/alpine") .cmd(asList("nc", "-p", port, "-l", "-u")) .exposedPorts(ImmutableSet.of(expose)) .build(); final HostConfig hostConfig = HostConfig.builder() .publishAllPorts(true) .build(); final ContainerCreation creation = docker.createContainer(config, testTag + "_syslog"); final String syslogContainerId = creation.id(); docker.startContainer(syslogContainerId, hostConfig); final ContainerInfo containerInfo = docker.inspectContainer(syslogContainerId); <START> assertThat(containerInfo.state().running(), equalTo(true)); <END> final String syslogEndpoint = syslogHost + ":" + containerInfo.networkSettings().ports().get(expose).get(0).hostPort(); startDefaultMaster(); startDefaultAgent(testHost(), "--syslog-redirect", syslogEndpoint); awaitHostStatus(testHost(), UP, LONG_WAIT_SECONDS, SECONDS); final List<String> command = asList("-c", "echo " + syslogOutput); final JobId jobId = createJob(testJobName, testJobVersion, TEST_IMAGE, Collections.EMPTY_LIST, ImmutableMap.of("SYSLOG_REDIRECTOR", "/syslog-redirector")); deployJob(jobId, testHost()); final TaskStatus taskStatus = awaitTaskState(jobId, testHost(), EXITED); { final String log; try (LogStream logs = docker.logs(taskStatus.getContainerId(), STDOUT, STDERR)) { log = logs.readFully(); } assertEquals("", log); } { final String log; try (LogStream logs = docker.logs(syslogContainerId, STDOUT, STDERR)) { log = logs.readFully(); } assertThat(log, containsString(syslogOutput)); } } }</code><technical_language>Want Polling.await here</technical_language>

Target:
public void test() throws Exception { final String syslogOutput = "should-be-redirected"; try (final DockerClient docker = getNewDockerClient()) { final String port = "4711"; final String expose = port + "/udp"; docker.pull(ALPINE); final ContainerConfig config = ContainerConfig.builder() .image(ALPINE) .cmd(asList("nc", "-p", port, "-l", "-u")) .exposedPorts(ImmutableSet.of(expose)) .build(); final HostConfig hostConfig = HostConfig.builder() .publishAllPorts(true) .build(); final ContainerCreation creation = docker.createContainer(config, testTag + "_syslog"); final String syslogContainerId = creation.id(); docker.startContainer(syslogContainerId, hostConfig); final ContainerInfo containerInfo = docker.inspectContainer(syslogContainerId); assertThat(containerInfo.state().running(), equalTo(true)); final String syslogEndpoint = syslogHost + ":" + containerInfo.networkSettings().ports().get(expose).get(0).hostPort(); startDefaultMaster(); startDefaultAgent(testHost(), "--syslog-redirect", syslogEndpoint); awaitHostStatus(testHost(), UP, LONG_WAIT_SECONDS, SECONDS); final List<String> command = Collections.EMPTY_LIST; final JobId jobId = createJob(testJobName, testJobVersion, TEST_IMAGE, command, ImmutableMap.of("SYSLOG_REDIRECTOR", "/syslog-redirector")); deployJob(jobId, testHost()); final TaskStatus taskStatus = awaitTaskState(jobId, testHost(), EXITED); { final String log; try (LogStream logs = docker.logs(taskStatus.getContainerId(), STDOUT, STDERR)) { log = logs.readFully(); } assertEquals("", log); } { final String log; try (LogStream logs = docker.logs(syslogContainerId, STDOUT, STDERR)) { log = logs.readFully(); } assertThat(log, containsString(syslogOutput)); } } }