Exemple #1
0
        public async void Dispose()
        {
            var peer = new FeatherUdpPeer <BinaryMessage>();

            Assert.False(peer.IsDisposed);
            peer.Bind(12347);
            Assert.False(peer.IsDisposed);
            peer.Dispose();
            Assert.True(peer.IsDisposed);

            Assert.Throws <ObjectDisposedException>(() => {
                peer.SendTo(new IPEndPoint(IPAddress.Loopback, 12346), TestMessage1);
            });

            await Assert.ThrowsAsync <ObjectDisposedException>(async() => {
                await peer.SendToAsync(new IPEndPoint(IPAddress.Loopback, 12346), TestMessage1);
            });
        }