コード例 #1
0
 public void RespondsToRFC6455()
 {
     using (var client = new TcpClient())
     {
         client.ProtocolFactory = WebSocketClientFactory.Default;
         client.Open(new IPEndPoint(IPAddress.Loopback, 20000));
         string resp = (string)client.ExecuteSync("abcdefg");
         Assert.AreEqual("gfedcba", resp);
     }
 }
コード例 #2
0
 public void RespondsToRFC6455_WithDeflate()
 {
     using (var client = new TcpClient())
     {
         //client.Extensions = new object[] { new PerFrameDeflate(0, false) };
         client.ProtocolFactory = WebSocketClientFactory.Default;
         client.Open(new IPEndPoint(IPAddress.Loopback, 20000));
         string resp = (string)client.ExecuteSync("abcdefg");
         Assert.AreEqual("gfedcba", resp);
     }
 }
コード例 #3
0
        public void ResurrectsListeners()
        {
            using (var client = new TcpClient())
            {
                client.ProtocolFactory = WebSocketClientFactory.Hixie76;
                client.Open(new IPEndPoint(IPAddress.Loopback, 20000));
                string resp = (string)client.ExecuteSync("abcdefg");
                Assert.AreEqual("gfedcba", resp);
            }

            server.ImmediateReconnectListeners = false;
            server.KillAllListeners();
            Thread.Sleep(500);
            server.Heartbeat();
            Thread.Sleep(500); // give it time to spin up!

            using (var client = new TcpClient())
            {
                client.ProtocolFactory = WebSocketClientFactory.Hixie76;
                client.Open(new IPEndPoint(IPAddress.Loopback, 20000));
                string resp = (string)client.ExecuteSync("abcdefgh");
                Assert.AreEqual("hgfedcba", resp);
            }
        }