예제 #1
0
        public void Initialize()
        {
            ManualResetEventSlim mevent = new ManualResetEventSlim(false);

            ipv4Server         = new UdpProtocol();
            ipv4Server.Address = serverAddress;
            ipv4Server.Port    = PORT;
            mevent.Reset();
            ipv4Server.OnConnectionRequested += (socket) =>
            {
                ipv4ServerClient = socket;
                mevent.Set();
            };
            ipv4Server.Listen();
            ipv6Server         = new UdpProtocol();
            ipv6Server.Address = IPAddress.IPv6Any.ToString();
            ipv6Server.Port    = PORT;
            ipv6Server.Listen();
            ipv6Server.OnConnectionRequested += (socket) =>
            {
                ipv6ServerClient = socket;
                mevent.Set();
            };
            ipv4Client = this.CreateIPV4ClientProtocol(clientAddress).Connect(serverAddress, PORT);
            mevent.Wait(1000);
            mevent.Reset();
            ipv6Client = this.CreateIPV6ClientProtocol(null).Connect(ipv6ServerAddress, PORT);
            mevent.Wait(1000);
        }
        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.");
        }
 public void ListenIPV6Test()
 {
     ipv6Protocol.Listen();
     Assert.IsTrue(ipv6Protocol.Listening, "Listening Flag was not turned on.");
 }