/// <summary> /// Subscribe /// </summary> private void subscribe() { // Create a subscriber and connect to the same address and port as the publisher SubscriberSocket subscriber = _context.CreateSubscriberSocket(); subscriber.Connect("tcp://127.0.0.1:9999"); // Set the topic subscriber.Subscribe("Test"); string message = String.Empty; // Receive the message and perform the assertion while (message == String.Empty) { message = subscriber.ReceiveString(); } Console.WriteLine(message); Assert.AreEqual("Test", message); }