protected function getMask()
    {
        if (!isset($this->mask)) {
            if (!$this->isMasked()) {
                throw new FrameException('Cannot get mask: frame is not masked');
            }
            $this->mask = substr($this->buffer, $this->getMaskOffset(), $this->getMaskSize());
        }
        return $this->mask;
    }