public void DisposeTest()
        {
            var ipv4Protocol = new UdpProtocol();

            ipv4Protocol.Port = PORT;
            ipv4Protocol.Listen();
            ipv4Protocol.Dispose();
            Assert.IsFalse(ipv4Protocol.Listening, "The protocol Listening property was true after disposing the protocol.");
        }
예제 #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (Udp != null)
                {
                    Udp.Dispose();
                    Udp = null;
                }

                Players = null;
            }

            GC.SuppressFinalize(this);
        }
예제 #3
0
 public void TestCleanup()
 {
     ipv4Client.Disconnect();
     ipv6Client.Disconnect();
     foreach (ISocket socket in sockets)
     {
         socket?.Disconnect();
     }
     if (ipv4Server.Listening)
     {
         ipv4Server.StopListening();
     }
     ipv4Server.Dispose();
     if (ipv6Server.Listening)
     {
         ipv6Server.StopListening();
     }
     ipv6Server.Dispose();
 }