assertEquals("fghij", footers[1].getValue());
}
//Test for when buffer is smaller than chunk size.
public void testChunkedInputStreamSmallBuffer() throws IOException {
ChunkedInputStream in = new ChunkedInputStream(
new HttpDataReceiverMockup(
EncodingUtils.getBytes(CHUNKED_INPUT, CONTENT_CHARSET)));
byte[] buffer = new byte[7];
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
while ((len = in.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
assertEquals(-1, in.read(buffer));
assertEquals(-1, in.read(buffer));
in.close();
EncodingUtils.getString(out.toByteArray(), CONTENT_CHARSET);
Header[] footers = in.getFooters();
assertNotNull(footers);
assertEquals(2, footers.length);
assertEquals("Footer1", footers[0].getName());
assertEquals("abcde", footers[0].getValue());
assertEquals("Footer2", footers[1].getName());