public function nextEndpoint() 
    {
        assert(is_array($this->_values[self::OPTION_ENDPOINT]));
        $endpoints = $this->_values[self::OPTION_ENDPOINT];

        $numberOfEndpoints = count($endpoints);

        $this->_currentEndpointIndex++;
        if ($this->_currentEndpointIndex >= $numberOfEndpoints) {
            $this->_currentEndpointIndex = 0;
        }

        $endpoint =  $endpoints[$this->_currentEndpointIndex];

        if ($numberOfEndpoints > 1) {
            $this->storeOptionsInCache();
        }

        return $endpoint;
    }