@Test public void serializeTest() { RegisterMessage registerMessage = new RegisterMessage(11, "bean.method"); assertThat(registerMessage.getCode()).isEqualTo(64); assertThat(registerMessage.getRequestId()).isEqualTo(11); assertThat(registerMessage.getProcedure()).isEqualTo("bean.method"); assertThat(registerMessage.isDiscloseCaller()).isFalse(); String json = serializeToJson(registerMessage); assertThat(json).isEqualTo("[64,11,{},\"bean.method\"]"); registerMessage = new RegisterMessage(927639114088448L, "com.maypp.add2", true); assertThat(registerMessage.getCode()).isEqualTo(64); assertThat(registerMessage.getRequestId()).isEqualTo(927639114088448L); assertThat(registerMessage.getProcedure()).isEqualTo("com.maypp.add2"); assertThat(registerMessage.isDiscloseCaller()).isTrue(); json = serializeToJson(registerMessage); assertThat(json).isEqualTo( "[64,927639114088448,{\"disclose_caller\":true},\"com.maypp.add2\"]"); }
@Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); if (this.discloseCaller) { generator.writeBooleanField("disclose_caller", this.discloseCaller); } generator.writeEndObject(); generator.writeString(this.procedure); }
RegisterMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); if (this.discloseCaller) { generator.writeBooleanField("disclose_caller", this.discloseCaller); } generator.writeEndObject(); generator.writeString(this.procedure); } }
RegisterMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); if (this.discloseCaller) { generator.writeBooleanField("disclose_caller", this.discloseCaller); } generator.writeEndObject(); generator.writeString(this.procedure); } RegisterMessage(long requestId, String procedure);  RegisterMessage(long requestId, String procedure, boolean discloseCaller); }
RegisterMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); if (this.discloseCaller) { generator.writeBooleanField("disclose_caller", this.discloseCaller); } generator.writeEndObject(); generator.writeString(this.procedure); } RegisterMessage(long requestId, String procedure);  RegisterMessage(long requestId, String procedure, boolean discloseCaller); static RegisterMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); String getProcedure(); boolean isDiscloseCaller(); @Override String toString(); }
RegisterMessage extends WampMessage { @Override public void serialize(JsonGenerator generator) throws IOException { generator.writeNumber(getCode()); generator.writeNumber(this.requestId); generator.writeStartObject(); if (this.discloseCaller) { generator.writeBooleanField("disclose_caller", this.discloseCaller); } generator.writeEndObject(); generator.writeString(this.procedure); } RegisterMessage(long requestId, String procedure);  RegisterMessage(long requestId, String procedure, boolean discloseCaller); static RegisterMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getRequestId(); String getProcedure(); boolean isDiscloseCaller(); @Override String toString(); static final int CODE; }