final public function decode(& $packet_data, $remaining_length, & $payload_pos)
    {
        $cmd = Utility::ParseCommand(ord($packet_data[0]));
        $message_type = $cmd['message_type'];
        if ($this->message->getMessageType() != $message_type) {
            throw new Exception('Unexpected Control Packet Type');
        }

        $flags        = $cmd['flags'];
        $this->setFlags($flags);

        $pos = 1;
        $rl_len = strlen(($this->remaining_length_bytes = Utility::EncodeLength($remaining_length)));
        $pos += $rl_len;

        $this->remaining_length = $remaining_length;
        $this->decodeVariableHeader($packet_data, $pos);
        $payload_pos = $pos;
    }