Exemplo n.º 1
0
        public void SendMultipartMessage()
        {
            using (var rep = new ResponseSocket())
            using (var req = new RequestSocket())
            {
                var port = rep.BindRandomPort("tcp://localhost");
                req.Connect("tcp://localhost:" + port);

                req.SendMoreFrame("Hello").SendFrame("World");

                CollectionAssert.AreEqual(new[] { "Hello", "World" }, rep.ReceiveMultipartStrings());

                rep.SendMoreFrame("Hello").SendFrame("Back");

                CollectionAssert.AreEqual(new[] { "Hello", "Back" }, req.ReceiveMultipartStrings());
            }
        }
Exemplo n.º 2
0
        public void SimpleReqRep(string address)
        {            
            using (var rep = new ResponseSocket())
            using (var req = new RequestSocket())
            {
                var port = rep.BindRandomPort(address);
                req.Connect(address + ":" + port);

                req.SendFrame("Hi");

                CollectionAssert.AreEqual(new[] { "Hi" }, rep.ReceiveMultipartStrings());

                rep.SendFrame("Hi2");

                CollectionAssert.AreEqual(new[] { "Hi2" }, req.ReceiveMultipartStrings());
            }
        }