Esempio n. 1
0
        public void TestSetupCertificateValidation_Amqp_ShouldSucceed()
        {
            ITransportSettings[] transportSettings = new ITransportSettings[] { new AmqpTransportSettings(TransportType.Amqp_Tcp_Only) };
            var certs = TrustBundleProvider.ParseCertificates(certificatesString);
            var customCertificateValidator = CustomCertificateValidator.Create(certs, transportSettings);

            Assert.IsNotNull(((AmqpTransportSettings)transportSettings[0]).RemoteCertificateValidationCallback);
        }
Esempio n. 2
0
        public void TestSetupCertificateValidation_Amqp_CallbackAlreadySet_ShouldSucceed()
        {
            var certs = TrustBundleProvider.ParseCertificates(certificatesString);

            var setting = new AmqpTransportSettings(TransportType.Amqp_Tcp_Only);
            RemoteCertificateValidationCallback callback = (sender, certificate, chain, sslPolicyErrors) =>
            {
                return(true);
            };

            setting.RemoteCertificateValidationCallback = callback;
            ITransportSettings[] transportSettings = new ITransportSettings[] { setting };
            var customCertificateValidator         = CustomCertificateValidator.Create(certs, transportSettings);

            Assert.IsNotNull(((AmqpTransportSettings)transportSettings[0]).RemoteCertificateValidationCallback);
        }
Esempio n. 3
0
        public void TestSetupCertificateValidation_Mqtt_CallbackAlreadySet_ShouldSucceed()
        {
            var trustBundleProvider = new TrustBundleProvider();
            var certs = trustBundleProvider.ParseCertificates(certificatesString);

            var setting = new MqttTransportSettings(TransportType.Mqtt_Tcp_Only);
            RemoteCertificateValidationCallback callback = (sender, certificate, chain, sslPolicyErrors) =>
            {
                return(true);
            };

            setting.RemoteCertificateValidationCallback = callback;
            ITransportSettings[] transportSettings = new ITransportSettings[] { setting };
            var customCertificateValidator         = CustomCertificateValidator.Create(certs, transportSettings);

            Assert.AreEqual(setting.RemoteCertificateValidationCallback, callback);
        }