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); string peerName; string message; Assert.IsFalse(listener.TryReceiveString(TimeSpan.FromMilliseconds(300), out peerName, out message)); } }
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(); string peerName; Assert.AreEqual("Hello", listener.ReceiveString(out peerName)); string message; Assert.IsFalse(listener.TryReceiveString(TimeSpan.FromMilliseconds(300), out peerName, out message)); } }
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(); string peerName; Assert.AreEqual("Hello", listener.ReceiveString(out peerName)); string message; Assert.IsFalse(listener.TryReceiveString(TimeSpan.FromMilliseconds(300), out peerName, out message)); } }
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); string peerName; string message; Assert.IsFalse(listener.TryReceiveString(TimeSpan.FromMilliseconds(300), out peerName, out message)); } }