JSONSerializer implements Serializer.SerializerInterface { @Override public @NotNull Map<String, String> decodeHeaders(@NotNull ByteBuf arg2) { String headerJSON = arg2.toString(CharsetUtil.UTF_8); Map<String, String> headers = null; if (headerJSON != null && !headerJSON.isEmpty() && !"\"\"".equals(headerJSON)) { headers = new Gson().fromJson(headerJSON, HEADER_TYPE); } return (headers == null) ? new HashMap<String, String>() : headers; }  @Override @NotNull String decodeEndpoint(@NotNull ByteBuf arg1); @Override @NotNull Map<String, String> decodeHeaders(@NotNull ByteBuf arg2); @Override T decodeBody(@NotNull ByteBuf arg3, @NotNull Class<T> bodyType); @Override ByteBuf encodeEndpoint(String method); @Override ByteBuf encodeHeaders(Map<String, String> applicationHeaders); @Override ByteBuf encodeBody(Object body);  }
@Test public void testDecodeEmptyHeaders() throws Exception { Map<String, String> emptyHeaders = new HashMap<>(); Map<String, String> decodedHeaders = serializer.decodeHeaders(Unpooled.EMPTY_BUFFER); assertEquals(emptyHeaders, decodedHeaders); }