@Test(expected=ConnectionClosedException.class)
public void testMissingClosingChunk() throws Exception {

    final String s = "10\r\n1234567890123456\r\n" +
            "5\r\n12345\r\n5\r\n12345\r\n";
    final ReadableByteChannel channel = new ReadableByteChannelMock(
            new String[] {s}, StandardCharsets.US_ASCII);
    final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
    final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
    final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
    final ByteBuffer dst = ByteBuffer.allocate(1024);
    long bytesRead = 0;
    try {
        while (dst.hasRemaining() && !decoder.isCompleted()) {
            final int i = decoder.read(dst);
            if (i > 0) {
                bytesRead += i;
            }
        }
    } catch (final MalformedChunkCodingException ex) {
        Assert.assertEquals(26L, bytesRead);
        Assert.assertEquals("12345678901234561234512345", CodecTestUtils.convert(dst));
        Assert.assertTrue(decoder.isCompleted());
        throw ex;
    }
}