@Nullable
    @Override
    public Message decode(@Nonnull RawMessage rawMessage) {
        final byte[] payload = rawMessage.getPayload();
        final Map<String, Object> event;
        try {
            event = objectMapper.readValue(payload, TypeReferences.MAP_STRING_OBJECT);
        } catch (IOException e) {
            LOG.error("Couldn't decode raw message {}", rawMessage);
            return null;
        }

        return parseEvent(event);
    }
@Test
    public void decodeReturnsNullIfPayloadCouldNotBeDecoded() throws Exception {
        assertThat(codec.decode(new RawMessage(new byte[0]))).isNull();
    }