Code example for SessionInputBuffer

Methods: read

0
        final byte[] tmp = new byte[2];
        Assert.assertEquals(-1, instream.read(tmp, 0, tmp.length));
        Assert.assertEquals(-1, instream.read());
        Assert.assertEquals(-1, instream.read(tmp, 0, tmp.length));
        Assert.assertEquals(-1, instream.read());
    } 
 
    @Test 
    public void testAvailable() throws Exception { 
        final byte[] input = new byte[] {'a', 'b', 'c'};
        final SessionInputBufferMock receiver = new SessionInputBufferMock(input);
        final IdentityInputStream instream = new IdentityInputStream(receiver);
        instream.read();
        Assert.assertEquals(2, instream.available());
        instream.close();
    } 
 
}