@Test public void deserializeTest() throws IOException { String json = "[6, {\"message\": \"The host is shutting down now.\"},\"wamp.error.system_shutdown\"]"; GoodbyeMessage goodbyeMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(goodbyeMessage.getCode()).isEqualTo(6); assertThat(goodbyeMessage.getMessage()) .isEqualTo("The host is shutting down now."); assertThat(goodbyeMessage.getReason()).isEqualTo("wamp.error.system_shutdown"); json = "[6,{},\"wamp.error.no_such_procedure\"]"; goodbyeMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(goodbyeMessage.getCode()).isEqualTo(6); assertThat(goodbyeMessage.getMessage()).isNull(); assertThat(goodbyeMessage.getReason()).isEqualTo("wamp.error.no_such_procedure"); }
public static GoodbyeMessage deserialize(JsonParser jp) throws IOException { String msg = null; jp.nextToken(); Map<String, Object> details = ParserUtil.readObject(jp); if (details != null) { msg = (String) details.get("message"); } jp.nextToken(); return new GoodbyeMessage(jp.getValueAsString(), msg); }
GoodbyeMessage extends WampMessage { public static GoodbyeMessage deserialize(JsonParser jp) throws IOException { String msg = null; jp.nextToken(); Map<String, Object> details = ParserUtil.readObject(jp); if (details != null) { msg = (String) details.get("message"); } jp.nextToken(); return new GoodbyeMessage(jp.getValueAsString(), msg); } }
GoodbyeMessage extends WampMessage { public static GoodbyeMessage deserialize(JsonParser jp) throws IOException { String msg = null; jp.nextToken(); Map<String, Object> details = ParserUtil.readObject(jp); if (details != null) { msg = (String) details.get("message"); } jp.nextToken(); return new GoodbyeMessage(jp.getValueAsString(), msg); } GoodbyeMessage(WampError reason, @Nullable String message);  GoodbyeMessage(WampError reason); private  GoodbyeMessage(String reason, @Nullable String message); }
GoodbyeMessage extends WampMessage { public static GoodbyeMessage deserialize(JsonParser jp) throws IOException { String msg = null; jp.nextToken(); Map<String, Object> details = ParserUtil.readObject(jp); if (details != null) { msg = (String) details.get("message"); } jp.nextToken(); return new GoodbyeMessage(jp.getValueAsString(), msg); } GoodbyeMessage(WampError reason, @Nullable String message);  GoodbyeMessage(WampError reason); private  GoodbyeMessage(String reason, @Nullable String message); static GoodbyeMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); String getReason(); @Nullable String getMessage(); @Override String toString(); }
GoodbyeMessage extends WampMessage { public static GoodbyeMessage deserialize(JsonParser jp) throws IOException { String msg = null; jp.nextToken(); Map<String, Object> details = ParserUtil.readObject(jp); if (details != null) { msg = (String) details.get("message"); } jp.nextToken(); return new GoodbyeMessage(jp.getValueAsString(), msg); } GoodbyeMessage(WampError reason, @Nullable String message);  GoodbyeMessage(WampError reason); private  GoodbyeMessage(String reason, @Nullable String message); static GoodbyeMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); String getReason(); @Nullable String getMessage(); @Override String toString();  }