public static ProcessorMetadata deserialize(final byte[] metaDataBytes) {
        if (metaDataBytes == null || metaDataBytes.length == 0) {
            return new ProcessorMetadata();
        }

        final ByteBuffer buffer = ByteBuffer.wrap(metaDataBytes);
        final int entrySize = buffer.getInt();
        final Map<String, Long> metadata = new HashMap<>(entrySize);
        for (int i = 0; i < entrySize; i++) {
            final int keySize = buffer.getInt();
            final byte[] keyBytes = new byte[keySize];
            buffer.get(keyBytes);
            final Long value = buffer.getLong();
            metadata.put(new String(keyBytes, StandardCharsets.UTF_8), value);
        }
        return new ProcessorMetadata(metadata);
    }
@Test
    public void shouldDeserializeNull() {
        final ProcessorMetadata deserialized = ProcessorMetadata.deserialize(null);
        assertThat(deserialized, is(new ProcessorMetadata()));
    }