public static IEndpoint New(CreateEndpointSettings settings)
        {
            try
            {
                Guard.Against.Null(settings.Address, "An address for the endpoint must be specified");
                Guard.Against.Null(settings.ErrorAddress, "An error address for the endpoint must be specified");
                Guard.Against.Null(settings.Serializer, "A message serializer for the endpoint must be specified");
                EnsureProtocolIsCorrect(settings.Address.Uri);
                EnsureProtocolIsCorrect(settings.ErrorAddress.Uri);

                var transport = new RabbitMqTransport(settings.Address, GetConnection(settings.Address.Uri));

                var errorSettings  = new CreateEndpointSettings(settings.ErrorAddress, settings);
                var errorTransport = new RabbitMqTransport(errorSettings.Address, GetConnection(errorSettings.Address.Uri));

                var endpoint = new RabbitMqEndpoint(settings.Address, settings.Serializer, transport, errorTransport);

                return(endpoint);
            }
            catch (Exception ex)
            {
                throw new EndpointException(settings.Address.Uri, "Failed to create NMS endpoint", ex);
            }
        }
        public static IEndpoint New(CreateEndpointSettings settings)
        {
            try
            {
                Guard.Against.Null(settings.Address, "An address for the endpoint must be specified");
                Guard.Against.Null(settings.ErrorAddress, "An error address for the endpoint must be specified");
                Guard.Against.Null(settings.Serializer, "A message serializer for the endpoint must be specified");
                EnsureProtocolIsCorrect(settings.Address.Uri);
                EnsureProtocolIsCorrect(settings.ErrorAddress.Uri);

                var transport = new RabbitMqTransport(settings.Address, GetConnection(settings.Address.Uri));

                var errorSettings = new CreateEndpointSettings(settings.ErrorAddress, settings);
                var errorTransport = new RabbitMqTransport(errorSettings.Address, GetConnection(errorSettings.Address.Uri));

                var endpoint = new RabbitMqEndpoint(settings.Address, settings.Serializer, transport, errorTransport);

                return endpoint;
            }
            catch (Exception ex)
            {
                throw new EndpointException(settings.Address.Uri, "Failed to create NMS endpoint", ex);
            }
        }