@Test public void deserializeTest() throws IOException { String json = "[67, 788923562]"; UnregisteredMessage unregisteredMessage = WampMessage .deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(unregisteredMessage.getCode()).isEqualTo(67); assertThat(unregisteredMessage.getRequestId()).isEqualTo(788923562L); assertThat(unregisteredMessage.getRegistrationId()).isNull(); assertThat(unregisteredMessage.getReason()).isNull(); json = "[67, 0, {\"registration\":334,\"reason\":\"another reason\"}]"; unregisteredMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(unregisteredMessage.getCode()).isEqualTo(67); assertThat(unregisteredMessage.getRequestId()).isEqualTo(0); assertThat(unregisteredMessage.getRegistrationId()).isEqualTo(334); assertThat(unregisteredMessage.getReason()).isEqualTo("another reason"); }
public static UnregisteredMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); Long registrationId = null; String reason = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { Map<String, Object> details = ParserUtil.readObject(jp); reason = (String) details.get("reason"); Object registrationObj = details.get("registration"); if (registrationObj != null) { registrationId = ((Number) registrationObj).longValue(); } } return new UnregisteredMessage(request, registrationId, reason); }
UnregisteredMessage extends WampMessage { public static UnregisteredMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); Long registrationId = null; String reason = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { Map<String, Object> details = ParserUtil.readObject(jp); reason = (String) details.get("reason"); Object registrationObj = details.get("registration"); if (registrationObj != null) { registrationId = ((Number) registrationObj).longValue(); } } return new UnregisteredMessage(request, registrationId, reason); } }
UnregisteredMessage extends WampMessage { public static UnregisteredMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); Long registrationId = null; String reason = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { Map<String, Object> details = ParserUtil.readObject(jp); reason = (String) details.get("reason"); Object registrationObj = details.get("registration"); if (registrationObj != null) { registrationId = ((Number) registrationObj).longValue(); } } return new UnregisteredMessage(request, registrationId, reason); } UnregisteredMessage(long requestId);  UnregisteredMessage(long requestId, @Nullable Long registrationId,
			@Nullable String reason);  UnregisteredMessage(UnregisterMessage unregisterMessage); }
UnregisteredMessage extends WampMessage { public static UnregisteredMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); Long registrationId = null; String reason = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { Map<String, Object> details = ParserUtil.readObject(jp); reason = (String) details.get("reason"); Object registrationObj = details.get("registration"); if (registrationObj != null) { registrationId = ((Number) registrationObj).longValue(); } } return new UnregisteredMessage(request, registrationId, reason); } UnregisteredMessage(long requestId);  UnregisteredMessage(long requestId, @Nullable Long registrationId,
			@Nullable String reason);  UnregisteredMessage(UnregisterMessage unregisterMessage); static UnregisteredMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable Long getRegistrationId(); @Nullable String getReason(); @Override String toString(); }
UnregisteredMessage extends WampMessage { public static UnregisteredMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long request = jp.getLongValue(); Long registrationId = null; String reason = null; JsonToken token = jp.nextToken(); if (token == JsonToken.START_OBJECT) { Map<String, Object> details = ParserUtil.readObject(jp); reason = (String) details.get("reason"); Object registrationObj = details.get("registration"); if (registrationObj != null) { registrationId = ((Number) registrationObj).longValue(); } } return new UnregisteredMessage(request, registrationId, reason); } UnregisteredMessage(long requestId);  UnregisteredMessage(long requestId, @Nullable Long registrationId,
			@Nullable String reason);  UnregisteredMessage(UnregisterMessage unregisterMessage); static UnregisteredMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable Long getRegistrationId(); @Nullable String getReason(); @Override String toString();  }