Пример #1
0
        public void TestBlocking()
        {
            using var radio = new RadioSocket();
            using var dish  = new DishSocket();
            dish.Join("2");

            radio.Bind("inproc://test-radio-dish");
            dish.Connect("inproc://test-radio-dish");

            radio.Send("1", "HELLO");
            radio.Send("2", "HELLO");

            var(group, msg) = dish.ReceiveString();
            Assert.Equal("2", group);
            Assert.Equal("HELLO", msg);
        }
Пример #2
0
        public void TestTcp()
        {
            using var radio = new RadioSocket();
            using var dish  = new DishSocket();
            dish.Join("2");

            int port = radio.BindRandomPort("tcp://*");

            dish.Connect($"tcp://127.0.0.1:{port}");

            Thread.Sleep(100);

            radio.Send("1", "HELLO");
            radio.Send("2", "HELLO");

            var(group, msg) = dish.ReceiveString();
            Assert.Equal("2", group);
            Assert.Equal("HELLO", msg);
        }