@Override
    public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) {
        if (dst instanceof HeapChannelBuffer) {
            getBytes(index, ((HeapChannelBuffer) dst).array, dstIndex, length);
        } else {
            dst.setBytes(dstIndex, array, index, length);
        }
    }
@Test
    void testEqualsAndHashcode() {
        HeapChannelBuffer b1 = new HeapChannelBuffer("hello-world".getBytes());
        HeapChannelBuffer b2 = new HeapChannelBuffer("hello-world".getBytes());

        MatcherAssert.assertThat(b1.equals(b2), is(true));
        MatcherAssert.assertThat(b1.hashCode(), is(b2.hashCode()));

        b1 = new HeapChannelBuffer("hello-world".getBytes());
        b2 = new HeapChannelBuffer("hello-worldd".getBytes());

        MatcherAssert.assertThat(b1.equals(b2), is(false));
        MatcherAssert.assertThat(b1.hashCode(), not(b2.hashCode()));
    }