private async Task <ClusterVersion?> GetVersionAsync(IEnumerable <Uri> servers, HttpClient httpClient)
        {
            if (servers == null)
            {
                throw new ArgumentNullException(nameof(servers));
            }

            foreach (var server in servers.ToList().Shuffle())
            {
                try
                {
                    _logger.LogTrace("Getting cluster version from {server}", server);

                    var config = await DownloadConfigAsync(httpClient, server).ConfigureAwait(false);

                    if (config != null && config.Nodes != null)
                    {
                        ClusterVersion?compatibilityVersion = null;
                        foreach (var node in config.Nodes)
                        {
                            if (ClusterVersion.TryParse(node.Version, out ClusterVersion version) &&
                                (compatibilityVersion == null || version < compatibilityVersion))
                            {
                                compatibilityVersion = version;
                            }
                        }

                        if (compatibilityVersion != null)
                        {
                            return(compatibilityVersion);
                        }
                    }
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "Unable to load config from {server}", server);
                }
            }

            // No version information could be loaded from any node
            _logger.LogDebug("Unable to get cluster version");
            return(null);
        }
        private async Task <ClusterVersion?> GetVersionAsync(IEnumerable <Uri> servers, CouchbaseHttpClient httpClient)
        {
            if (servers == null)
            {
                throw new ArgumentNullException("servers");
            }

            foreach (var server in servers.ToList().Shuffle())
            {
                try
                {
                    _log.Trace("Getting cluster version from {0}", server);

                    var config = await DownloadConfigAsync(httpClient, server).ContinueOnAnyContext();

                    if (config != null && config.Nodes != null)
                    {
                        ClusterVersion?compatabilityVersion = null;
                        foreach (var node in config.Nodes)
                        {
                            if (ClusterVersion.TryParse(node.Version, out ClusterVersion version) &&
                                (compatabilityVersion == null || version < compatabilityVersion))
                            {
                                compatabilityVersion = version;
                            }
                        }

                        if (compatabilityVersion != null)
                        {
                            return(compatabilityVersion);
                        }
                    }
                }
                catch (Exception e)
                {
                    _log.Error(string.Format("Unable to load config from {0}", server), e);
                }
            }

            // No version information could be loaded from any node
            _log.Debug("Unable to get cluster version");
            return(null);
        }