Пример #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);
        }
Пример #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;
        }
Пример #3
0
 public TlsTransportInitiator(TlsTransportSettings transportSettings)
 {
     this.transportSettings = transportSettings;
 }
Пример #4
0
 public TlsTransportInitiator(TlsTransportSettings transportSettings)
 {
     this.transportSettings = transportSettings;
 }
Пример #5
0
 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;
 }
Пример #7
0
 public TlsTransportListener(TlsTransportSettings transportSettings) : base("tls-listener")
 {
     this.transportSettings = transportSettings;
     this.onTransportOpened = new AsyncCallback(this.OnTransportOpened);
 }
Пример #8
0
 public TlsTransportListener(TlsTransportSettings transportSettings)
 {
     this.transportSettings = transportSettings;
     this.onTransportOpened = this.OnTransportOpened;
 }
Пример #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));
 }
Пример #10
0
 public TlsTransportProvider(TlsTransportSettings tlsSettings)
 {
     this.tlsSettings = tlsSettings;
     this.ProtocolId = ProtocolId.AmqpTls;
 }
Пример #11
0
 public TlsTransportProvider(TlsTransportSettings tlsSettings)
 {
     this.tlsSettings = tlsSettings;
     this.ProtocolId  = ProtocolId.AmqpTls;
 }