public static ByteBuffer toByteBuffer(final Message message, final short version) {
        ObjectSerializationCache cache = new ObjectSerializationCache();
        int messageSize = message.size(cache, version);
        ByteBufferAccessor bytes = new ByteBufferAccessor(ByteBuffer.allocate(messageSize));
        message.write(bytes, cache, version);
        bytes.flip();
        return bytes.buffer();
    }
Compare two RawTaggedFields lists.
A null list is equivalent to an empty one in this context.
clients/src/main/java/org/apache/kafka/common/protocol/MessageUtil.java