Esempio n. 1
0
        public static void Initialize(TestContext context)
        {
            var info = new ServerInfo
            {
                Address        = IPAddress.Any,
                Port           = Port,
                MaxConnections = 2,
                VersionString  = Version
            };
            var daemon = new ServerDaemon();

            Assert.IsTrue(daemon.Start(info));
            Assert.IsTrue(daemon.IsRunning);

            _client = new TcpClient("localhost", Port);

            Assert.IsTrue(_client.Connected);

            _stream = _client.GetStream();
            var rec   = new byte[5000];
            var i     = _stream.Read(rec, 0, rec.Length);
            var hello =
                "2a0000000A43727970746f53716c0000000000111111111111111100000008020000000000000000000000000000"
                .ToByteArray();

            CollectionAssert.AreEqual(hello, rec.Take(i).ToArray());
            var login = "******".ToByteArray();

            _stream.Write(login, 0, login.Length);
            i = _stream.Read(rec, 0, rec.Length);
            var ok = new OKPacket(number: 2).ToByteArray();

            CollectionAssert.AreEqual(ok, rec.Take(i).ToArray());
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            ServerDaemon daemon = new ServerDaemon();

            daemon.Init();
            daemon.Start();
        }
Esempio n. 3
0
        public static int Main(String[] args)
        {
            var requestQueue  = new RequestQueue();
            var responseQueue = new ResponseQueue();

            responseDaemon = new ResponseDaemon(responseQueue);
            serverDaemon   = new ServerDaemon(requestQueue);
            commandDaemon  = new CommandDaemon(requestQueue, responseQueue);

            responseDaemon.Start();
            commandDaemon.Start();
            serverDaemon.Start();
            Console.ReadKey();
            return(0);
        }