}
@Test
public void testClose() throws IOException {
final String correct = "1234567890123456-";
final SessionInputBuffer inbuffer = new SessionInputBufferMock(EncodingUtils.getBytes(
correct, CONTENT_CHARSET));
final InputStream in = new ContentLengthInputStream(inbuffer, 16L);
in.close();
in.close();
try {
in.read();
Assert.fail("IOException should have been thrown");
} catch (final IOException ex) {
// expected
}
final byte[] tmp = new byte[10];
try {
in.read(tmp);
Assert.fail("IOException should have been thrown");
} catch (final IOException ex) {
// expected
}
try {
in.read(tmp, 0, tmp.length);
Assert.fail("IOException should have been thrown");
} catch (final IOException ex) {
// expected
}
Assert.assertEquals('-', inbuffer.read());
}