protected function createSocket()
    {
        $now = $this->getCurrentTime();
        if ($this->retryTime === null) {
            $attempt = true;
        } else {
            $attempt = ($now >= $this->retryTime);
        }

        if (!$attempt) {
            return;
        }

        $this->socket = $this->makeSocket();
        if ($this->socket !== false) {
            $this->retryTime = null;
            return;
        }

        if ($this->retryTime === null) {
            $this->retryPeriod = $this->retryStart;
        } else {
            $this->retryPeriod *= $this->retryFactor;
            if ($this->retryPeriod > $this->retryMax) {
                $this->retryPeriod = $this->retryMax;
            }
        }
        $this->retryTime = $now + $this->retryPeriod;
    }