Esempio n. 1
0
        public void BasicFunctionality()
        {
            var server = SimpleSocket.CreateServer(new HelloWorldHandler());
            var client = new SimpleSocketClient <int, string>();

            try{
                server.Start();
                Assert.AreEqual("hello", client.Call(1));
                Assert.AreEqual("привет", client.Call(2));
            }
            finally{
                server.Stop();
            }
        }
Esempio n. 2
0
        public void BinaryFormatterFunctionality()
        {
            var server = SimpleSocket.CreateServer(new Calculator());
            var client = new SimpleSocketClient <SimpleData, SimpleData>();

            try{
                server.Start();
                Assert.AreEqual(10, client.Call(new SimpleData {
                    Command = 1, Arg = 6, Arg2 = 4
                }).Result);
                Assert.AreEqual(2, client.Call(new SimpleData {
                    Command = 2, Arg = 6, Arg2 = 4
                }).Result);
            }
            finally{
                server.Stop();
            }
        }
Esempio n. 3
0
        public void CanStopAndStartListener()
        {
            var server = SimpleSocket.CreateServer(new HelloWorldHandler());
            var client = new SimpleSocketClient <int, string>();

            try
            {
                server.Start();
                client.Call(1);
                //Assert.AreEqual("hello", client.Call(1));
                server.Stop();
                Assert.Throws <AggregateException>(() => client.Call(1));
                server.Start();
                client.Call(1);
                //Assert.AreEqual("hello", client.Call(1));
            }
            finally
            {
                server.Stop();
            }
        }
Esempio n. 4
0
 /// <summary>
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public AuthProtocol Execute(AuthProtocol request)
 {
     return(_client.Call(request));
 }