ByteArrayOutputStream outstream = new ByteArrayOutputStream();
WritableByteChannel channel = Channels.newChannel(outstream);
ContentEncoder encoder = new MockupEncoder(channel);
SimpleOutputBuffer buffer = new SimpleOutputBuffer(4);
buffer.write(EncodingUtils.getAsciiBytes("stuff"));
buffer.write(';');
buffer.produceContent(encoder);
buffer.write(EncodingUtils.getAsciiBytes("more "));
buffer.write(EncodingUtils.getAsciiBytes("stuff"));
buffer.produceContent(encoder);
byte[] content = outstream.toByteArray();
assertEquals("stuff;more stuff", EncodingUtils.getAsciiString(content));
}