private void deliverMessage(SockJSSocket sock, String address, Message message) {
   JsonObject envelope =
       new JsonObject().putString("address", address).putValue("body", message.body);
   if (message.replyAddress != null) {
     envelope.putString("replyAddress", message.replyAddress);
   }
   sock.writeBuffer(new Buffer(envelope.encode()));
 }
  public void handle(final SockJSSocket sock) {

    final Map<String, Handler<Message>> handlers = new HashMap<>();

    sock.endHandler(
        new SimpleHandler() {
          public void handle() {
            handleSocketClosed(sock, handlers);
          }
        });

    sock.dataHandler(
        new Handler<Buffer>() {
          public void handle(Buffer data) {
            handleSocketData(sock, data, handlers);
          }
        });
  }