@Override
 public void decode(byte[] content) throws Exception {
   ChatMessageContent.SendChatReq req = ChatMessageContent.SendChatReq.parseFrom(content);
   this.channelID = req.getChannelID();
   this.content = req.getContent();
   this.chatType = req.getChatType();
   if (req.getToUser() != null) {
     toUser = new ChatUser();
     toUser.setUserId(req.getToUser().getUserid());
     toUser.setUsername(req.getToUser().getUsername());
     toUser.setSex(req.getToUser().getSex());
   }
 }
 @Override
 public byte[] encode() {
   ChatMessageContent.SendChatReq.Builder b = ChatMessageContent.SendChatReq.newBuilder();
   b.setChannelID(this.channelID);
   b.setContent(this.content);
   b.setChatType(this.chatType);
   if (toUser != null) {
     ChatMessageContent.ChatUser.Builder c = ChatMessageContent.ChatUser.newBuilder();
     c.setUserid(toUser.getUserId());
     c.setUsername(toUser.getUsername());
     c.setSex(toUser.isSex());
     b.setToUser(c.build());
   }
   return b.build().toByteArray();
 }