@Test
public void testCodingBeyondContentLimitFile() throws Exception {

    final ReadableByteChannel channel = new ReadableByteChannelMock(
            new String[] {
                    "stuff;",
                    "more stuff; and a lot more stuff"}, StandardCharsets.US_ASCII);
    final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
    final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
    final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
            channel, inbuf, metrics, 16);
    createTempFile();
    final RandomAccessFile testfile  = new RandomAccessFile(this.tmpfile, "rw");
    try {
        final FileChannel fchannel = testfile.getChannel();
        long bytesRead = decoder.transfer(fchannel, 0, 6);
        Assert.assertEquals(6, bytesRead);
        Assert.assertFalse(decoder.isCompleted());
        Assert.assertEquals(6, metrics.getBytesTransferred());
        bytesRead = decoder.transfer(fchannel,0 , 10);
        Assert.assertEquals(10, bytesRead);
        Assert.assertTrue(decoder.isCompleted());
        Assert.assertEquals(16, metrics.getBytesTransferred());
        bytesRead = decoder.transfer(fchannel, 0, 1);
        Assert.assertEquals(-1, bytesRead);
        Assert.assertTrue(decoder.isCompleted());
        Assert.assertEquals(16, metrics.getBytesTransferred());
    } finally {
        testfile.close();
    }
}