@Nullable
    @Override
    public Message decode(@Nonnull RawMessage rawMessage) {
        final byte[] payload = rawMessage.getPayload();
        final JsonNode event;
        try {
            event = objectMapper.readTree(payload);
            if (event == null || event.isMissingNode()) {
                throw new IOException("null result");
            }
        } catch (IOException e) {
            LOG.error("Couldn't decode raw message {}", rawMessage);
            return null;
        }

        return parseEvent(event);
    }
@Test
    public void decodeMessagesHandlesGenericBeatWithCloudGCE() throws Exception {
        final Message message = codec.decode(messageFromJson("generic-with-cloud-gce.json"));
        assertThat(message).isNotNull();
        assertThat(message.getMessage()).isEqualTo("-");
        assertThat(message.getSource()).isEqualTo("unknown");
        assertThat(message.getTimestamp()).isEqualTo(new DateTime(2016, 4, 1, 0, 0, DateTimeZone.UTC));
        assertThat(message.getField("beats_type")).isEqualTo("beat");
        assertThat(message.getField("beat_foo")).isEqualTo("bar");
        assertThat(message.getField("beat_meta_cloud_provider")).isEqualTo("gce");
        assertThat(message.getField("beat_meta_cloud_machine_type")).isEqualTo("projects/1234567890/machineTypes/f1-micro");
        assertThat(message.getField("beat_meta_cloud_instance_id")).isEqualTo("1234556778987654321");
        assertThat(message.getField("beat_meta_cloud_project_id")).isEqualTo("my-dev");
        assertThat(message.getField("beat_meta_cloud_availability_zone")).isEqualTo("projects/1234567890/zones/us-east1-b");
    }