}
@Test public void testReadOutput() throws Exception {
makeService(FakeWorkers.PrintClient.class, "foo", "bar");
service.startAsync().awaitRunning();
StreamItem item1 = readItem();
assertEquals(Kind.DATA, item1.kind());
Set<String> lines = Sets.newHashSet();
lines.add(item1.content().toString());
StreamItem item2 = readItem();
assertEquals(Kind.DATA, item2.kind());
lines.add(item2.content().toString());
assertEquals(Sets.newHashSet("foo", "bar"), lines);
assertEquals(State.RUNNING, service.state());
StreamItem item3 = readItem();
assertEquals(Kind.EOF, item3.kind());
awaitStopped(100, TimeUnit.MILLISECONDS);
assertTerminated();
}