ConnectionHandler <AzureServiceBusConnection> GetConnection(
            Cache <string, ConnectionHandler <AzureServiceBusConnection> > cache,
            IAzureServiceBusEndpointAddress address)
        {
            var ns = address.Uri.Host;

            return(cache.Get(ns, _ =>
            {
                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("Creating RabbitMQ connection: {0}", address.Uri);
                }

                ConnectionSettingsBuilder builder = _connectionSettingsBuilders.Get(ns, __ =>
                {
                    if (_log.IsDebugEnabled)
                    {
                        _log.DebugFormat("Using default configurator for connection: {0}", address.Uri);
                    }

                    var configurator = new NamespaceConnectionSettingsConfigurator(ns);

                    return configurator.Configure();
                });

                IConnectionSettings connectionSettings = builder.Build();

                var connection = new AzureServiceBusConnectionImpl(address, connectionSettings.TokenProvider);

                return new ConnectionHandlerImpl <AzureServiceBusConnection>(connection);
            }));
        }
        ConnectionHandler<AzureServiceBusConnection> GetConnection(
            Cache<string, ConnectionHandler<AzureServiceBusConnection>> cache,
            IAzureServiceBusEndpointAddress address)
        {
            var ns = address.Uri.Host;

            return cache.Get(ns, _ =>
                {
                    if (_log.IsDebugEnabled)
                        _log.DebugFormat("Creating RabbitMQ connection: {0}", address.Uri);

                    ConnectionSettingsBuilder builder = _connectionSettingsBuilders.Get(ns, __ =>
                        {
                            if (_log.IsDebugEnabled)
                                _log.DebugFormat("Using default configurator for connection: {0}", address.Uri);

                            var configurator = new NamespaceConnectionSettingsConfigurator(ns);

                            return configurator.Configure();
                        });

                    IConnectionSettings connectionSettings = builder.Build();

                    var connection = new AzureServiceBusConnectionImpl(address, connectionSettings.TokenProvider);

                    return new ConnectionHandlerImpl<AzureServiceBusConnection>(connection);
                });
        }