code: public static WfdMessage fromString(String str) throws MessageException {
          if (str == null) {
              throw new MessageException(MessageException.Reason.NULL_MESSAGE);
          }
          JsonObject o = new JsonParser().parse(str).getAsJsonObject();
          WfdMessage msg = new WfdMessage();
          msg.msgContent = o.getAsJsonObject(KEY_MSG_CONTENT);
          msg.type = o.get(KEY_MSG_TYPE).getAsString();
          if (msg.type.equals(TYPE_REQUEST) || msg.type.equals(TYPE_RESPONSE)) {
              msg.sequenceNumber = o.get(KEY_TIMESTAMP).getAsLong();
          } else {
              msg.sequenceNumber = -1;
          }
          msg.receiverId = o.get(KEY_RECEIVER_ID).getAsString();
          msg.senderId = o.get(KEY_SENDER_ID).getAsString();
          return msg;
  
      }
docs: Returns a {@link WfdMessage} given its string representation. If the
  string cannot be parsed returns null.
  
  @param str
  @return