refactor ProtocolPacket to simply do serialization/deserialization