Example #1
0
        public static void SubtestTransport(ITransport ta, ITransport tb, string addr)
        {
            var maddr = Multiaddress.Decode(addr);

            Assert.That(maddr, Is.Not.Null);

            var listener = ta.Listen(maddr);

            Assert.That(listener, Is.Not.Null);

            var dialer = tb.Dialer(maddr);

            Assert.That(dialer, Is.Not.Null);

            var accepted = listener.AcceptAsync(CancellationToken.None);
            var dialed   = dialer.DialAsync(listener.Multiaddress, CancellationToken.None);

            Task.WaitAll(accepted, dialed);

            var a = accepted.Result;
            var b = dialed.Result;

            try
            {
                Assert.DoesNotThrow(() => CheckDataTransfer(a, b));
            }
            finally
            {
                a.Dispose();
                b.Dispose();
            }
        }