Inheritance: IHumbleClient
示例#1
0
        public static void Main(string[] args)
        {
            //// create the server, configure echo command and start listening
            var server = new HumbleServer();
            server.AddCommand("echo", () => new EchoCommand());
            server.Start(0);

            //// create the client, connect to the server, send the command and the parameters
            var client = new HumbleClient();
            client.Connect("localhost", server.Port);
            client.Send("echo").Send("hello world");

            Console.WriteLine("Client received: " + client.Receive());
            Console.ReadKey();
        }
示例#2
0
        private void OneThreadExecution()
        {
            _countdown.Signal();

            var client = new HumbleClient();
            _mre.WaitOne();
            client.Connect("localhost", Server.Port);
            client.Send("wait");

            try
            {
                var data = client.Receive();
                if (data.Equals("1") == false)
                {
                    Assert.Ignore("Should receive 1 on thread " + Thread.CurrentThread.Name);
                }
            }
            catch (Exception exception)
            {
                Assert.Ignore("Exception on thread " + Thread.CurrentThread.Name + ": " + exception.Message);
            }

            _countdown.Signal();
        }