toByteArray

Encodes the packet to a ByteArray.