Wp/caroline 3/1

Имхо, надо эту магию вынести в отдельный метод, типа:

    std::unique_ptr<char[]> MakeMessage(Message* message) {
      size_t size_t size = message->ByteSize();
      size_t buffer_size = size + google::protobuf::io::CodedOutputStream::VarintSize32(size);
      std::unique_ptr<char[]> bit_message(new char[buffer_size]);
      google::protobuf::io::ArrayOutputStream stream_message(bit_message, buffer_size);
      google::protobuf::io::CodedOutputStream coded_message(&stream_message);
      coded_message.WriteVarint32(size);
      message->SerializeToCodedStream(&coded_message);
      return bit_message;
    }