@Test public void serializeTest() { UnsubscribedMessage unsubscribedMessage = new UnsubscribedMessage(1); assertThat(unsubscribedMessage.getCode()).isEqualTo(35); assertThat(unsubscribedMessage.getRequestId()).isEqualTo(1); assertThat(unsubscribedMessage.getSubscriptionId()).isNull(); assertThat(unsubscribedMessage.getReason()).isNull(); String json = serializeToJson(unsubscribedMessage); assertThat(json).isEqualTo("[35,1]"); unsubscribedMessage = new UnsubscribedMessage(2, 1208L, "removed"); assertThat(unsubscribedMessage.getCode()).isEqualTo(35); assertThat(unsubscribedMessage.getRequestId()).isEqualTo(2); assertThat(unsubscribedMessage.getSubscriptionId()).isEqualTo(1208L); assertThat(unsubscribedMessage.getReason()).isEqualTo("removed"); json = serializeToJson(unsubscribedMessage); assertThat(json) .isEqualTo("[35,2,{\"reason\":\"removed\",\"subscription\":1208}]"); }
@Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); if (this.subscriptionId != null || this.reason != null) { generator.writeStartObject(); if (this.reason != null) { generator.writeStringField("reason", this.reason); } if (this.subscriptionId != null) { generator.writeNumberField("subscription", this.subscriptionId); } generator.writeEndObject(); } }
UnsubscribedMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); if (this.subscriptionId != null || this.reason != null) { generator.writeStartObject(); if (this.reason != null) { generator.writeStringField("reason", this.reason); } if (this.subscriptionId != null) { generator.writeNumberField("subscription", this.subscriptionId); } generator.writeEndObject(); } } }
UnsubscribedMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); if (this.subscriptionId != null || this.reason != null) { generator.writeStartObject(); if (this.reason != null) { generator.writeStringField("reason", this.reason); } if (this.subscriptionId != null) { generator.writeNumberField("subscription", this.subscriptionId); } generator.writeEndObject(); } } UnsubscribedMessage(long requestId);  UnsubscribedMessage(long requestId, @Nullable Long subscriptionId,
			@Nullable String reason);  UnsubscribedMessage(UnsubscribeMessage unsubscribeMessage); }
UnsubscribedMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); if (this.subscriptionId != null || this.reason != null) { generator.writeStartObject(); if (this.reason != null) { generator.writeStringField("reason", this.reason); } if (this.subscriptionId != null) { generator.writeNumberField("subscription", this.subscriptionId); } generator.writeEndObject(); } } UnsubscribedMessage(long requestId);  UnsubscribedMessage(long requestId, @Nullable Long subscriptionId,
			@Nullable String reason);  UnsubscribedMessage(UnsubscribeMessage unsubscribeMessage); static UnsubscribedMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable Long getSubscriptionId(); @Nullable String getReason(); @Override String toString(); }
UnsubscribedMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); if (this.subscriptionId != null || this.reason != null) { generator.writeStartObject(); if (this.reason != null) { generator.writeStringField("reason", this.reason); } if (this.subscriptionId != null) { generator.writeNumberField("subscription", this.subscriptionId); } generator.writeEndObject(); } } UnsubscribedMessage(long requestId);  UnsubscribedMessage(long requestId, @Nullable Long subscriptionId,
			@Nullable String reason);  UnsubscribedMessage(UnsubscribeMessage unsubscribeMessage); static UnsubscribedMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); @Nullable Long getSubscriptionId(); @Nullable String getReason(); @Override String toString();  }