assertEquals(out.length, tmp.length);
for (int i = 0; i < out.length; i++) {
assertEquals(out[i], tmp[i]);
}
SessionInputBufferMockup inbuffer = new SessionInputBufferMockup(tmp);
// these read operations will have no effect
assertEquals(0, inbuffer.read(null, 0, 10));
assertEquals(0, inbuffer.read(null));
long receivedBytes = inbuffer.getMetrics().getBytesTransferred();
assertEquals(0, receivedBytes);
byte[] in = new byte[40];
off = 0;
remaining = in.length;
while (remaining > 0) {
int chunk = 10;
if (chunk > remaining) {
chunk = remaining;
}
int l = inbuffer.read(in, off, chunk);
if (l == -1) {
break;
}
off += l;
remaining -= l;
}
for (int i = 0; i < out.length; i++) {
assertEquals(out[i], in[i]);
}
assertEquals(-1, inbuffer.read(tmp));
assertEquals(-1, inbuffer.read(tmp));
receivedBytes = inbuffer.getMetrics().getBytesTransferred();
assertEquals(out.length, receivedBytes);
}