Exemplo n.º 1
0
        public void CanStartServer()
        {
            srv.On("/test", "CanStartServer");
            var wcl = new HttpClient();
            var str = wcl.GetString("http://127.0.0.1:8094/test");

            Console.WriteLine(str);
            Assert.AreEqual("CanStartServer", str);
        }
Exemplo n.º 2
0
        public void CanProxiseByAppid()
        {
            var aconfig1 = new HostConfig();
            aconfig1.AddQorpentBinding(98);
            var aconfig2 = new HostConfig();
            aconfig2.AddQorpentBinding(99);
            aconfig2.Proxize["/call1"] = "appid=98";
            var h1 = new HostServer(aconfig1);
            var h2 = new HostServer(aconfig2);
            h1.On("/call1", "hello!");
            var result = "";
            try
            {
                h1.Start();
                h2.Start(); 
                Thread.Sleep(100);
                result = new HttpClient().GetString("http://127.0.0.1:14990/call1");
            }
            finally
            {
                h1.Stop();
                h2.Stop();

            }
            Assert.AreEqual("hello!", result);
        }
Exemplo n.º 3
0
        public void CanProxiseByAppid()
        {
            var aconfig1 = new HostConfig();

            aconfig1.AddQorpentBinding(98);
            var aconfig2 = new HostConfig();

            aconfig2.AddQorpentBinding(99);
            aconfig2.Proxize["/call1"] = "appid=98";
            var h1 = new HostServer(aconfig1);
            var h2 = new HostServer(aconfig2);

            h1.On("/call1", "hello!");
            var result = "";

            try
            {
                h1.Start();
                h2.Start();
                Thread.Sleep(100);
                result = new HttpClient().GetString("http://127.0.0.1:14990/call1");
            }
            finally
            {
                h1.Stop();
                h2.Stop();
            }
            Assert.AreEqual("hello!", result);
        }
Exemplo n.º 4
0
        public void FixtureSetup()
        {
            var hostConfig = new HostConfig();

            hostConfig.Bindings.Add(new HostBinding {
                Port = 50651, Schema = HostSchema.Http, Interface = "127.0.0.1"
            });
            hostConfig.Bindings.Add(new HostBinding {
                Port = 50652, Schema = HostSchema.Https, Interface = "127.0.0.1"
            });
            host = new HostServer(hostConfig);
            host.On("/x.html", _html, "text/hmtl");
            host.On("/x2.html", _html2, "text/hmtl");
            host.Start();
            httpend  = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 50651);
            httpsend = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 50652);
        }