Example #1
0
        private void SetupEndpoint(bool auth, bool sec, bool useAltHost)
        {
            KillEndpoint();

            //CFX.Utilities.AppLog.LoggingEnabled = true;
            //CFX.Utilities.AppLog.LogFilePath = @"c:\stuff\cfxlog.txt";
            //CFX.Utilities.AppLog.LoggingLevel = CFX.Utilities.LogMessageType.Debug | CFX.Utilities.LogMessageType.Error | CFX.Utilities.LogMessageType.Info | CFX.Utilities.LogMessageType.Warn;
            //CFX.Utilities.AppLog.LoggingLevel = CFX.Utilities.LogMessageType.Error | CFX.Utilities.LogMessageType.Warn;
            //CFX.Utilities.AppLog.AmqpTraceEnabled = true;

            endpoint = new AmqpCFXEndpoint();
            endpoint.ValidateCertificates = false;
            endpoint.Open(TestSettings.ClientHandle, certificate: TestSettings.GetCertificate(sec));

            string virtualHost = null;

            if (useAltHost)
            {
                virtualHost = TestSettings.BrokerVirtualHost;
            }

            Exception ex  = null;
            Uri       uri = TestSettings.GetBrokerUri(auth, sec);

            if (!endpoint.TestPublishChannel(uri, TestSettings.BrokerExchange, out ex, virtualHost))  //, TestSettings.GetCertificate(sec)))
            {
                throw new Exception($"Cannot connect to broker at {uri.ToString()}, Exchange {TestSettings.BrokerExchange}:  {ex.Message}", ex);
            }

            endpoint.AddPublishChannel(uri, TestSettings.BrokerExchange, virtualHost, TestSettings.GetCertificate(sec));
        }
Example #2
0
        private void SetupListener(bool auth, bool sec, bool useAltHost)
        {
            KillListener();

            listener = new AmqpCFXEndpoint();
            listener.ValidateCertificates = true;
            listener.Open(TestSettings.ClientHandle, certificate: TestSettings.GetCertificate(sec));
            listener.OnCFXMessageReceived += Listener_OnCFXMessageReceived;

            string virtualHost = null;

            if (useAltHost)
            {
                virtualHost = TestSettings.BrokerVirtualHost;
            }

            Exception ex  = null;
            Uri       uri = TestSettings.GetBrokerUri(auth, sec);

            if (!listener.TestSubscribeChannel(uri, TestSettings.BrokerQueue, out ex, virtualHost, TestSettings.GetCertificate(sec)))
            {
                throw new Exception($"Cannot subscribe to broker at {uri.ToString()}, Queue {TestSettings.BrokerQueue}:  {ex.Message}", ex);
            }

            listener.AddSubscribeChannel(uri, TestSettings.BrokerQueue, virtualHost, TestSettings.GetCertificate(sec));
        }
Example #3
0
        private void SetupEndpoint(bool auth, bool sec, bool useAltHost)
        {
            KillEndpoint();

            endpoint = new AmqpCFXEndpoint();
            endpoint.ValidateCertificates = false;
            endpoint.Open(TestSettings.ClientHandle, certificate: TestSettings.GetCertificate(sec));

            string virtualHost = null;

            if (useAltHost)
            {
                virtualHost = TestSettings.BrokerVirtualHost;
            }

            Exception ex  = null;
            Uri       uri = TestSettings.GetBrokerUri(auth, sec);

            if (!endpoint.TestPublishChannel(uri, TestSettings.BrokerExchange, out ex, virtualHost))
            {
                throw new Exception($"Cannot connect to broker at {uri.ToString()}, Exchange {TestSettings.BrokerExchange}:  {ex.Message}", ex);
            }

            endpoint.AddPublishChannel(uri, TestSettings.BrokerExchange, TestSettings.BrokerVirtualHost);
        }
Example #4
0
        private void SetupEndpoint(bool auth, bool sec)
        {
            KillEndpoint();

            endpoint = new AmqpCFXEndpoint();
            endpoint.Open(TestSettings.ClientHandle, certificate: TestSettings.GetCertificate(sec));
            endpoint.ValidateCertificates = false;

            //CFX.Utilities.AppLog.LoggingEnabled = true;
            //CFX.Utilities.AppLog.LogFilePath = @"c:\stuff\cfxlog.txt";
            //CFX.Utilities.AppLog.LoggingLevel = CFX.Utilities.LogMessageType.Debug | CFX.Utilities.LogMessageType.Error | CFX.Utilities.LogMessageType.Info | CFX.Utilities.LogMessageType.Warn;
            //CFX.Utilities.AppLog.LoggingLevel = CFX.Utilities.LogMessageType.Error | CFX.Utilities.LogMessageType.Warn;
            //CFX.Utilities.AppLog.AmqpTraceEnabled = true;

            //AmqpCFXEndpoint.MaxFrameSize = 1000000;

            Exception ex  = null;
            Uri       uri = TestSettings.GetListenerUri(auth, sec);

            if (!endpoint.TestPublishChannel(uri, TestSettings.ListenerAddress, out ex))
            {
                throw new Exception($"Cannot connect to listener at {uri.ToString()}:  {ex.Message}", ex);
            }

            endpoint.AddPublishChannel(uri, TestSettings.ListenerAddress);
        }
        private void SetupEndpoint(bool auth, bool sec)
        {
            KillEndpoint();

            endpoint = new AmqpCFXEndpoint();
            endpoint.Open(TestSettings.ClientHandle, certificate: TestSettings.GetCertificate(sec));
            endpoint.ValidateCertificates = false;

            Exception ex  = null;
            Uri       uri = TestSettings.GetListenerUri(auth, sec);

            if (!endpoint.TestPublishChannel(uri, TestSettings.ListenerAddress, out ex))
            {
                throw new Exception($"Cannot connect to listener at {uri.ToString()}:  {ex.Message}", ex);
            }

            endpoint.AddPublishChannel(uri, TestSettings.ListenerAddress);
        }
Example #6
0
        private void SetupListener(bool auth, bool sec)
        {
            KillListener();

            listener = new AmqpCFXEndpoint();
            listener.Open(TestSettings.ListenerHandle, TestSettings.GetListenerUri(auth, sec), certificate: TestSettings.GetCertificate(sec));
            listener.OnCFXMessageReceivedFromListener += Listener_OnCFXMessageReceivedFromListener;
            listener.OnRequestReceived += Listener_OnRequestReceived;

            listener.AddListener(TestSettings.ListenerAddress);
        }