JsonObjectMapperDecoder extends MessageToMessageDecoder<ByteBuf> { String decodeString(JsonNode tree, String name) { final JsonNode n = tree.get(name); if (n == null || n.isNull()) { return null; } return n.asText(); } JsonObjectMapperDecoder();  static final Set<String> EMPTY_TAGS; static final Map<String, String> EMPTY_ATTRIBUTES; static final Map<String, String> EMPTY_RESOURCES; }
@Test public void nullKey() throws IOException { final JsonNode json = mapper.readTree("{\"key\": null}"); final String key = j.decodeString(json, "key"); assertNull(key); }
@Test public void noHostInJson() throws IOException { final JsonNode json = mapper.readTree("{\"key\": null}"); final String host = j.decodeString(json, "host"); assertNull(host); }