public void TestRegister()
        {
            var connectionParams = new ConnectionParams();

            _connectionResolver.RegisterAsync("correlationId", connectionParams).Wait();
            var configList = _connectionResolver.GetAll();

            Assert.Equal(configList.Count(), 1);

            connectionParams.DiscoveryKey = "Discovery key value";
            _connectionResolver.RegisterAsync("correlationId", connectionParams).Wait();
            configList = _connectionResolver.GetAll();

            Assert.Equal(configList.Count(), 2);

            _connectionResolver.RegisterAsync("correlationId", connectionParams).Wait();
            configList = _connectionResolver.GetAll();
            var configFirst = configList.FirstOrDefault();
            var configLast  = configList.LastOrDefault();

            Assert.Equal(configList.Count(), 3);
            Assert.Equal(configFirst.Get("protocol"), "http");
            Assert.Equal(configFirst.Get("host"), "localhost");
            Assert.Equal(configFirst.Get("port"), "3000");
            Assert.Equal(configLast.Get("discovery_key"), "Discovery key value");
        }
        /// <summary>
        /// Registers the given connection in all referenced discovery services. This
        /// method can be used for dynamic service discovery.
        /// </summary>
        /// <param name="correlationId">(optional) transaction id to trace execution through call chain.</param>
        public async Task RegisterAsync(string correlationId)
        {
            var connection = await _connectionResolver.ResolveAsync(correlationId);

            ValidateConnection(correlationId, connection);

            await _connectionResolver.RegisterAsync(correlationId, connection);
        }
        /// <summary>
        /// Registers the given connection in all referenced discovery services. This
        /// method can be used for dynamic service discovery.
        /// </summary>
        /// <param name="correlationId">(optional) transaction id to trace execution through call chain.</param>
        public async Task RegisterAsync(string correlationId)
        {
            var connection = await _connectionResolver.ResolveAsync(correlationId);

            var credential = await _credentialResolver.LookupAsync(correlationId);

            ValidateConnection(correlationId, connection, credential);

            await _connectionResolver.RegisterAsync(correlationId, connection);
        }