StdoutTransport implements UnpartitionedTransport { @Override public void sendBatch(TransportBuffer buffer) { System.out.println(buffer.getInternalBuffer().toString()); System.out.flush(); }  @Override void sendBatch(TransportBuffer buffer);  }
@Test public void testStdout() throws IllegalStateException, IOException { ByteArrayOutputStream bo = new ByteArrayOutputStream(); System.setOut(new PrintStream(bo)); StdoutTransport transport = new StdoutTransport(); GenericTransportBuffer buf = new GenericTransportBuffer(1, false, new StdoutTransportSerializer()); InternalEvent event = new InternalEvent("junk", new LambdaContext(new TestContext()), 123); event.setSerialized("junk"); buf.add(event); transport.sendBatch(buf); bo.flush(); String allWrittenLines = new String(bo.toByteArray()); assertEquals("junk\n", allWrittenLines); }