public function handleEncrypt()
    {
        $ex = null;

        try
        {
            if ($this->isEncrypted())
            {
                return;
            }

            $this->encrypt($this->config['ssl_method']);

            if ($this->isEncrypted())
            {
                $this->pause();
                $this->resume();
            }
        }
        catch (Error $ex)
        {}
        catch (Exception $ex)
        {}

        if ($ex !== null)
        {
            $this->close();
            $this->emit('error', [ $this, $ex ]);
        }
    }