Пример #1
0
        public void serverdown()
        {
            transport.is_server = true;
            string    uri    = "tcp://localhost:4008?filter=KeepAlive";
            KeepAlive filter = newKeepAlive(uri);

            filter.SetSession(session);
            filter.SessionNotify(SessionConsts.DOWN);
            Assert.IsFalse(session.up);
        }
Пример #2
0
        public void constructor3()
        {
            transport.is_server = false;
            String    uri    = "tcp://localhost:4008?filter=KeepAlive";
            KeepAlive filter = newKeepAlive(uri);

            filter.SetSession(session);

            Assert.AreSame(transport.GetSession(), filter);
            Assert.AreSame(filter.GetSession(), session);
            Assert.AreEqual(filter.GetServer(), false);
            Assert.AreEqual(filter.GetCount(), 4);
            Assert.AreEqual(filter.GetDelay(), 15);
        }
Пример #3
0
        public void constructor2()
        {
            transport.is_server = true;
            String    uri    = "tcp://localhost:4008?filter=KeepAlive&KeepAlive.delay=20&KeepAlive.count=5";
            KeepAlive filter = newKeepAlive(uri);

            filter.SetSession(session);

            Assert.AreSame(transport.GetSession(), filter);
            Assert.AreSame(filter.GetSession(), session);
            Assert.AreEqual(filter.GetServer(), true);
            Assert.AreEqual(filter.GetCount(), 5);
            Assert.AreEqual(filter.GetDelay(), 20);
        }
Пример #4
0
        public void serverUp()
        {
            transport.is_server = true;
            string    uri    = "tcp://localhost:4008?filter=KeepAlive";
            KeepAlive filter = newKeepAlive(uri);

            filter.SetSession(session);
            filter.SessionNotify(SessionConsts.UP);
            Message req = ConstructMessage();

            filter.SessionMessage(null, req);

            Assert.AreEqual(req.Reply().ToString(), transport.msg.ToString());
        }
Пример #5
0
        public void clientup1()
        {
            transport.is_server = false;
            string    uri    = "tcp://localhost:4008?filter=KeepAlive&KeepAlive.delay=2";
            KeepAlive filter = newKeepAlive(uri);

            filter.SetSession(session);
            filter.SessionNotify(SessionConsts.UP);
            Console.WriteLine("Sleeping for 4 seconds");
            Thread.Sleep(4000);
            Console.WriteLine("Out of sleep");
            Assert.AreEqual(What.TRANSPORT_MESSAGE, transport.what);
            Message msg = transport.msg;

            Assert.AreEqual("_Etch_KeepAliveReq", msg.GetXType.Name);
            Assert.AreEqual(4, msg.Get(new Field("count")));
            Assert.AreEqual(2, msg.Get(new Field("delay")));
        }