@Nullable
    @Override
    public Message decode(@Nonnull RawMessage rawMessage) {
        final String msg = new String(rawMessage.getPayload(), charset);
        try (Timer.Context ignored = this.decodeTime.time()) {
            final ResolvableInetSocketAddress address = rawMessage.getRemoteAddress();
            final InetSocketAddress remoteAddress;
            if (address == null) {
                remoteAddress = null;
            } else {
                remoteAddress = address.getInetSocketAddress();
            }
            return parse(msg, remoteAddress == null ? null : remoteAddress.getAddress(), rawMessage.getTimestamp());
        }
    }
@Test
    @SuppressForbidden("Deliberate invocation")
    public void rfc5424_section6_5_messages() {
        // See https://tools.ietf.org/html/rfc5424#section-6.5
        final Map<String, Map<String, Object>> rfc3164messages = ImmutableMap.of(
            "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8",
            ImmutableMap.<String, Object>builder()
                .put("timestamp", new DateTime("2003-10-11T22:14:15.003", DateTimeZone.UTC).withZone(DateTimeZone.getDefault()))
                .put("source", "mymachine.example.com")
                .put("level", 2)
                .put("facility", "security/authorization")
                .put("application_name", "su")
                .put("message", "ID47 - BOM'su root' failed for lonvick on /dev/pts/8")
                .build(),

            "<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc 8710 - - %% It's time to make the do-nuts.",
            ImmutableMap.<String, Object>builder()
                .put("timestamp", new DateTime("2003-08-24T05:14:15.000", DateTimeZone.forOffsetHours(-7)).withZone(DateTimeZone.getDefault()))
                .put("source", "192.0.2.1")
                .put("level", 5)
                .put("facility", "local4")
                .put("application_name", "myproc")
                .put("process_id", "8710")
                .put("message", "%% It's time to make the do-nuts.")
                .build(),

            "<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"] An application event log entry...",
            ImmutableMap.<String, Object>builder()
                .put("timestamp", new DateTime("2003-10-11T22:14:15.003", DateTimeZone.UTC).withZone(DateTimeZone.getDefault()))
                .put("source", "mymachine.example.com")
                .put("level", 5)
                .put("facility", "local4")
                .put("application_name", "evntslog")
                .put("message", "An application event log entry...")
                .put("iut", "3")
                .put("eventID", "1011")
                .put("eventSource", "Application")
                .build(),

            "<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"]",
            ImmutableMap.<String, Object>builder()
                .put("timestamp", new DateTime("2003-10-11T22:14:15.003", DateTimeZone.UTC).withZone(DateTimeZone.getDefault()))
                .put("source", "mymachine.example.com")
                .put("level", 5)
                .put("facility", "local4")
                .put("application_name", "evntslog")
                .put("iut", "3")
                .put("eventID", "1011")
                .put("eventSource", "Application")
                .build()

        );

        for (Map.Entry<String, Map<String, Object>> entry : rfc3164messages.entrySet()) {
            final Message message = codec.decode(buildRawMessage(entry.getKey()));
            assertThat(message).isNotNull();
            assertThat(message.getFields()).containsAllEntriesOf(entry.getValue());
        }
    }