//these write operations should have no effect
outbuffer.writeLine((String)null);
outbuffer.writeLine((CharArrayBuffer)null);
outbuffer.flush();
HttpTransportMetrics tmetrics = outbuffer.getMetrics();
final long bytesWritten = tmetrics.getBytesTransferred();
long expected = 0;
for (final String teststr : teststrs) {
expected += (teststr.length() + 2/*CRLF*/);
}
Assert.assertEquals(expected, bytesWritten);
final SessionInputBufferMock inbuffer = new SessionInputBufferMock(
outbuffer.getData());
for (final String teststr : teststrs) {
Assert.assertEquals(teststr, inbuffer.readLine());
}
Assert.assertNull(inbuffer.readLine());
Assert.assertNull(inbuffer.readLine());
tmetrics = inbuffer.getMetrics();
final long bytesRead = tmetrics.getBytesTransferred();
Assert.assertEquals(expected, bytesRead);
}