Exemplo n.º 1
0
        public void SubscribeToDifferentTopic()
        {
            using (var speaker = new NetMQBeacon())
                using (var listener = new NetMQBeacon())
                {
                    speaker.Configure(9999);

                    listener.Configure(9999);
                    listener.Subscribe("B");

                    // this should send one broadcast message and stop
                    speaker.Publish("Hello", s_publishInterval);

                    Assert.IsFalse(listener.TryReceive(TimeSpan.FromMilliseconds(300), out BeaconMessage message));
                }
        }
Exemplo n.º 2
0
        public void Unsubscribe()
        {
            using (var speaker = new NetMQBeacon())
                using (var listener = new NetMQBeacon())
                {
                    speaker.Configure(9999);

                    listener.Configure(9999);
                    listener.Subscribe("H");

                    // this should send one broadcast message and stop
                    speaker.Publish("Hello", s_publishInterval);
                    Thread.Sleep(10);
                    listener.Unsubscribe();

                    Assert.AreEqual("Hello", listener.Receive().String);

                    Assert.IsFalse(listener.TryReceive(TimeSpan.FromMilliseconds(300), out BeaconMessage message));
                }
        }
Exemplo n.º 3
0
        public void Unsubscribe()
        {
            using (var speaker = new NetMQBeacon())
            using (var listener = new NetMQBeacon())
            {
                speaker.Configure(9999);

                listener.Configure(9999);
                listener.Subscribe("H");

                // this should send one broadcast message and stop
                speaker.Publish("Hello", s_publishInterval);
                Thread.Sleep(10);
                listener.Unsubscribe();

                Assert.AreEqual("Hello", listener.Receive().String);

                BeaconMessage message;
                Assert.IsFalse(listener.TryReceive(TimeSpan.FromMilliseconds(300), out message));
            }
        }
Exemplo n.º 4
0
        public void SubscribeToDifferentTopic()
        {
            using (var speaker = new NetMQBeacon())
            using (var listener = new NetMQBeacon())
            {
                speaker.Configure(9999);

                listener.Configure(9999);
                listener.Subscribe("B");

                // this should send one broadcast message and stop
                speaker.Publish("Hello", s_publishInterval);

                BeaconMessage message;
                Assert.IsFalse(listener.TryReceive(TimeSpan.FromMilliseconds(300), out message));
            }
        }