Example #1
0
        protected ConnectionListener(
            Uri addressUri,
            AmqpSettings amqpSettings,
            AmqpConnectionSettings connectionSettings)
        {
            amqpSettings.ValidateListenerSettings();
            this.listenAddress = addressUri;
            this.amqpSettings = amqpSettings;
            this.connectionSettings = connectionSettings;
            this.onAcceptTransport = this.OnAcceptTransport;

            TcpTransportSettings tcpSettings = new TcpTransportSettings();
            tcpSettings.SetEndPoint(addressUri.Host, addressUri.Port, true);
            TransportListener tpListener = null;
            if (addressUri.Scheme.Equals(AmqpConstants.SchemeAmqps, StringComparison.OrdinalIgnoreCase))
            {
                TlsTransportProvider tlsProvider = this.amqpSettings.GetTransportProvider<TlsTransportProvider>();
                if (tlsProvider == null)
                {
                    throw Fx.Exception.ArgumentNull("TlsSecurityProvider");
                }

                Fx.Assert(tlsProvider.Settings.Certificate != null, "Must have a valid certificate.");
                TlsTransportSettings tlsSettings = new TlsTransportSettings(tcpSettings, false);
                tlsSettings.Certificate = tlsProvider.Settings.Certificate;
                tpListener = tlsSettings.CreateListener();
            }
            else
            {
                tpListener = tcpSettings.CreateListener();
            }

            this.transportListener = new AmqpTransportListener(new TransportListener[] { tpListener }, this.amqpSettings);
            this.onConnectionOpenComplete = new AsyncCallback(this.OnConnectionOpenComplete);
        }
Example #2
0
        public TlsTransport(TransportBase innerTransport, TlsTransportSettings tlsSettings)
            : base()
        {
            Fx.Assert((tlsSettings.IsInitiator && tlsSettings.TargetHost != null) || (!tlsSettings.IsInitiator && tlsSettings.Certificate != null),
                tlsSettings.IsInitiator ? "Must have a target host for the client." : "Must have a certificate for the server.");
            this.innerTransport = innerTransport;
            this.isInitiator = tlsSettings.IsInitiator;
            this.targetHost = tlsSettings.TargetHost;
            this.serverCert = tlsSettings.Certificate;
            this.sslStream = tlsSettings.CertificateValidationCallback == null ?
                new SslStream(new TransportStream(this.innerTransport), false) :
                new SslStream(new TransportStream(this.innerTransport), false, tlsSettings.CertificateValidationCallback);

            this.onReadComplete = this.OnReadComplete;
            this.onOpenComplete = this.OnOpenComplete;
            this.onWriteComplete = this.OnWriteComplete;
        }
 public TlsTransportInitiator(TlsTransportSettings transportSettings)
 {
     this.transportSettings = transportSettings;
 }
 public TlsTransportInitiator(TlsTransportSettings transportSettings)
 {
     this.transportSettings = transportSettings;
 }
 public TlsTransportListener(TlsTransportSettings transportSettings)
 {
     this.transportSettings = transportSettings;
     this.onTransportOpened = this.OnTransportOpened;
 }
 public TlsTransportProvider(TlsTransportSettings tlsSettings)
 {
     this.tlsSettings = tlsSettings;
     base.ProtocolId  = Microsoft.ServiceBus.Messaging.Amqp.ProtocolId.AmqpTls;
 }
Example #7
0
 public TlsTransportListener(TlsTransportSettings transportSettings) : base("tls-listener")
 {
     this.transportSettings = transportSettings;
     this.onTransportOpened = new AsyncCallback(this.OnTransportOpened);
 }
 public TlsTransportListener(TlsTransportSettings transportSettings)
 {
     this.transportSettings = transportSettings;
     this.onTransportOpened = this.OnTransportOpened;
 }
Example #9
0
 public TlsTransport(TransportBase innerTransport, TlsTransportSettings tlsSettings) : base("tls")
 {
     this.innerTransport = innerTransport;
     this.tlsSettings    = tlsSettings;
     this.sslStream      = (tlsSettings.CertificateValidationCallback == null ? new SslStream(new TransportStream(this.innerTransport), false) : new SslStream(new TransportStream(this.innerTransport), false, tlsSettings.CertificateValidationCallback));
 }
Example #10
0
 public TlsTransportProvider(TlsTransportSettings tlsSettings)
 {
     this.tlsSettings = tlsSettings;
     this.ProtocolId = ProtocolId.AmqpTls;
 }
 public TlsTransportProvider(TlsTransportSettings tlsSettings)
 {
     this.tlsSettings = tlsSettings;
     this.ProtocolId  = ProtocolId.AmqpTls;
 }