Exemplo n.º 1
0
        public void UdpAdapter_Throws_Exception_When_No_Server()
        {
            UdpAdapter adapter = new UdpAdapter("127.0.0.1", 9999);

            try
            {
                adapter.Connect();
                Assert.Fail("Exception was not thrown.");
            }
            catch { }

            adapter.Dispose();
        }
Exemplo n.º 2
0
        public void UdpAdapter_Throws_Exception_After_Server_Shutdown()
        {
            ResonanceUdpServer udp = new ResonanceUdpServer(9999);

            udp.Start();
            udp.Dispose();

            UdpAdapter adapter = new UdpAdapter("127.0.0.1", 9999);

            try
            {
                adapter.Connect();
                Assert.Fail("Exception was not thrown.");
            }
            catch { }

            adapter.Dispose();
        }
Exemplo n.º 3
0
        public void UdpAdapter_Connection_Success()
        {
            ResonanceUdpServer udp = new ResonanceUdpServer(9999);

            udp.ConnectionRequest += (x, e) =>
            {
                e.Accept();
            };
            udp.Start();

            UdpAdapter adapter = new UdpAdapter("127.0.0.1", 9999);

            adapter.Connect();

            Assert.IsTrue(adapter.State == ResonanceComponentState.Connected);

            adapter.Dispose();
            udp.Dispose();
        }
Exemplo n.º 4
0
        public void UdpAdapter_Throws_Exception_On_Connection_Declined()
        {
            ResonanceUdpServer udp = new ResonanceUdpServer(9999);

            udp.ConnectionRequest += (x, e) =>
            {
                e.Decline();
            };
            udp.Start();

            UdpAdapter adapter = new UdpAdapter("127.0.0.1", 9999);

            try
            {
                adapter.Connect();
                Assert.Fail("Exception was not thrown.");
            }
            catch { }

            adapter.Dispose();
            udp.Dispose();
        }