public void Socket_Send_Receive_Multipart_Test(string endpoint) { using (var receiver = new ZmqSocket(ZmqContext.Current, ZmqSocketType.Rep)) using (var senderContext = new ZmqContext()) using (var sender = (endpoint.StartsWith("inproc") ? ZmqContext.Current : senderContext).Socket(ZmqSocketType.Req)) { receiver.Bind(endpoint); sender.Connect(endpoint); var message1 = MessageTests.GetTestData(); var message2 = MessageTests.GetTestData(); sender.Send(message1, ZmqSendReceiveFlags.SendMore); sender.Send(message2); using (var receivedMessage1 = new ZmqMessage()) { receiver.Receive(receivedMessage1); CollectionAssert.AreEqual(message1, receivedMessage1.ToArray()); Assert.IsTrue(receivedMessage1.HasMore); } using (var receivedMessage2 = new ZmqMessage()) { receiver.Receive(receivedMessage2); CollectionAssert.AreEqual(message2, receivedMessage2.ToArray()); Assert.IsFalse(receivedMessage2.HasMore); } } }
public void Socket_Send_Receive_Test(string endpoint) { using (var receiver = ZmqContext.Current.Socket(ZmqSocketType.Rep)) using (var senderContext = new ZmqContext()) using (var sender = (endpoint.StartsWith("inproc") ? ZmqContext.Current : senderContext).Socket(ZmqSocketType.Req)) { receiver.Bind(endpoint); sender.Connect(endpoint); var message = MessageTests.GetTestData(); sender.Send(message); var receivedMessage = receiver.Receive(); CollectionAssert.AreEqual(message, receivedMessage); } }