ReadableByteChannel channel = new ReadableByteChannelMockup(
new String[] {"stuff;", "more stuff"}, "US-ASCII");
ContentDecoder decoder = new MockupDecoder(channel);
SimpleInputBuffer buffer = new SimpleInputBuffer(4);
int count = buffer.consumeContent(decoder);
assertEquals(16, count);
assertTrue(decoder.isCompleted());
byte[] b1 = new byte[5];
int len = buffer.read(b1);
assertEquals("stuff", EncodingUtils.getAsciiString(b1, 0, len));
int c = buffer.read();
assertEquals(';', c);
byte[] b2 = new byte[1024];
len = buffer.read(b2);
assertEquals("more stuff", EncodingUtils.getAsciiString(b2, 0, len));
assertEquals(-1, buffer.read());
assertEquals(-1, buffer.read(b2));
assertEquals(-1, buffer.read(b2, 0, b2.length));
assertTrue(buffer.isEndOfStream());
buffer.reset();
assertFalse(buffer.isEndOfStream());
}