public void testReadByteBufferWithMaxLen() throws Exception {
byte[] pattern = "0123456789ABCDEF".getBytes("US-ASCII");
ReadableByteChannel channel = newChannel(pattern);
HttpParams params = new BasicHttpParams();
SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, params);
while (inbuf.fill(channel) > 0) {
}
ByteBuffer dst = ByteBuffer.allocate(16);
Assert.assertEquals(10, inbuf.read(dst, 10));
dst.flip();
Assert.assertEquals(dst, ByteBuffer.wrap(pattern, 0, 10));