fn pack_payload_type<W: Write>(
    t: PayloadType,
    codec: &mut Codec<W>
) -> Result<(), WriteError>