code: public Object deserialize(JsonObject message) {
      String type = message.getString("type");
      if (type == null) {
        return message.getValue("value");
      } else {
        switch (type) {
          case "buffer":
            return new Buffer(message.getBinary("value"));
          case "bytes":
            return message.getBinary("value");
          case "serialized":
            byte[] bytes = message.getBinary("value");
            ObjectInputStream stream = null;
            try {
              stream = new ThreadObjectInputStream(new ByteArrayInputStream(bytes));
              return stream.readObject();
            } catch (ClassNotFoundException | IOException e) {
              throw new SerializationException(e.getMessage());
            } finally {
              if (stream != null) {
                try {
                  stream.close();
                } catch (IOException e) {
                }
              }
            }
          default:
            return message.getValue("value");
        }
      }
    }
docs: Deserializes an input message.
  
  @param message The message to deserialize.
  @return The message value.