1.proto文件加入要传输的类型 数据类型必须是bytes

optional bytes sava = 5;

 2.发送端

 liyan l = new liyan();
    l.setAge("888");
    l.setName("889");

    ByteArrayOutputStream out = new ByteArrayOutputStream();
     ObjectOutputStream oout = new ObjectOutputStream(out);
     oout.writeObject(l);
    person.setSava(com.google.protobuf.ByteString.copyFrom(out.toByteArray()));

 3.接收端

 ByteArrayInputStream byteIn = new ByteArrayInputStream(person.getSava().toByteArray());
      ObjectInputStream in;
 try {
  in = new ObjectInputStream(byteIn);
  liyan l = (liyan) in.readObject();