public static boolean prefixEquals(ChannelBuffer bufferA, ChannelBuffer bufferB, int count) {
        final int aLen = bufferA.readableBytes();
        final int bLen = bufferB.readableBytes();
        if (aLen < count || bLen < count) {
            return false;
        }

        int aIndex = bufferA.readerIndex();
        int bIndex = bufferB.readerIndex();

        for (int i = count; i > 0; i--) {
            if (bufferA.getByte(aIndex) != bufferB.getByte(bIndex)) {
                return false;
            }
            aIndex++;
            bIndex++;
        }

        return true;
    }
@Test
    void testPrefixEquals() {
        ChannelBuffer bufA = ChannelBuffers.wrappedBuffer("abcedfaf".getBytes());
        ChannelBuffer bufB = ChannelBuffers.wrappedBuffer("abcedfaa".getBytes());
        Assertions.assertTrue(ChannelBuffers.equals(bufA, bufB));
        Assertions.assertTrue(ChannelBuffers.prefixEquals(bufA, bufB, 7));
        Assertions.assertFalse(ChannelBuffers.prefixEquals(bufA, bufB, 8));
    }