/// <summary>
        /// Tries to resolve the endpoint ip, used if the connection fails
        /// </summary>
        /// <returns>The resolved endpoint as an ip and port</returns>
        internal EndPoint ResolveEndPoint()
        {
            IPHostEntry entry    = null;
            var         waiting  = true;
            var         tryCount = _tries;
            string      message  = "";

            while (tryCount > 0 && waiting)
            {
                try
                {
                    tryCount--;
                    entry = Dns.GetHostEntry(_hostname);
                    if (entry.AddressList.Length > 0)
                    {
                        waiting = false;
                    }
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                    Thread.Sleep(_delay);
                }
            }


            if (waiting || entry == null)
            {
                _log.LogError("Could not resolve hostname to ip");
                throw new TimeoutException(string.Format("Could not resolve hostname to Ip after trying the specified amount: {0}. " + message, _tries));
            }

            _log.LogDebug("Resolved configuration endpoint {Hostname} to {Address}.", _hostname, entry.AddressList[0]);

            lock (_endpointLock)
            {
                _endPoint = new IPEndPoint(entry.AddressList[0], _port);
            }

            lock (_nodesLock)
            {
                if (_node != null)
                {
                    try
                    {
                        _node.Dispose();
                    }
                    catch
                    {
                        // ignored
                    }
                }
                _node = _config.NodeFactory.CreateNode(_endPoint, _config.SocketPool, _config.LoggerFactory);
                _nodes.Clear();
                _nodes.Add(_node);
            }
            return(_endPoint);
        }
 public void Test_Construction()
 {
     Assert.That(_node, Is.Not.Null, "Failed to construct MemcachedNode using defaults");
     _node.Dispose();
 }