MessageToClientEncoder implements Encoder.Text<MessageToClient> { @Override public String encode(MessageToClient object) throws EncodeException { return object.toJson(); }  @Override String encode(MessageToClient object); @Override void init(EndpointConfig config); @Override void destroy();  }
@Test public void testEncode() throws EncodeException { System.out.println("encode"); MessageToClient messageToClient = new MessageToClient(); messageToClient.setDeadline(1000); messageToClient.setId(UUID.randomUUID().toString()); messageToClient.setResult("RESULT"); String result = messageToClientEncoder.encode(messageToClient); assertThat(result).isEqualTo(messageToClient.toJson()); }