Code example for ByteArrayInputStream

0
        assertEquals(expectedCommand, sb.toString());
    } 
 
    @Test 
    public void bulkReply() { 
        InputStream is = new ByteArrayInputStream("$6\r\nfoobar\r\n".getBytes());
        byte[] response = (byte[]) Protocol.read(new RedisInputStream(is));
        assertArrayEquals(SafeEncoder.encode("foobar"), response);
    } 
 
    @Test 
    public void fragmentedBulkReply() { 
        FragmentedByteArrayInputStream fis = new FragmentedByteArrayInputStream(
                "$30\r\n012345678901234567890123456789\r\n".getBytes());
        byte[] response = (byte[]) Protocol.read(new RedisInputStream(fis));
        assertArrayEquals(SafeEncoder.encode("012345678901234567890123456789"), 
                response);
    } 
 
    @Test 
    public void nullBulkReply() {