Code example for HttpTransportMetricsImpl

    public void testCodingBeyondContentLimitFile() throws Exception { 
        final ReadableByteChannel channel = new ReadableByteChannelMock(
                new String[] {
                        "more stuff; and a lot more stuff"}, Consts.ASCII); 
        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
        final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
        final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
                channel, inbuf, metrics, 16);
        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);
Experience pair programming with AI  Get Codota for Java