Example #1
0
        private async void ServerEvent(IService service)
        {
            AChannel channel = await service.GetChannel();

            for (int i = 0; i < echoTimes; ++i)
            {
                byte[] bytes = await channel.RecvAsync();

                CollectionAssert.AreEqual("0123456789".ToByteArray(), bytes);
                Array.Reverse(bytes);
                channel.SendAsync(bytes);
            }
        }
Example #2
0
        private async void ClientEvent(IService service, string hostName, ushort port)
        {
            AChannel channel = service.GetChannel(hostName, port);

            for (int i = 0; i < echoTimes; ++i)
            {
                channel.SendAsync("0123456789".ToByteArray());
                byte[] bytes = await channel.RecvAsync();

                CollectionAssert.AreEqual("9876543210".ToByteArray(), bytes);
            }

            this.barrier.RemoveParticipant();
        }