private void Run()
 {
     while (isRunning)
     {
         Console.WriteLine("Getting Servers from Registry");
         ListServersRequestInitiator c = factory.CreateFromConversationType <ListServersRequestInitiator>();
         c.RemoteEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1024); // TODO - Make dynamic
         c.Launch();
         Thread.Sleep(10000);
     }
 }
Esempio n. 2
0
        public void ClientConversations()
        {
            // Test factory constructor
            ClientConversationFactory f = new ClientConversationFactory();

            Assert.IsNotNull(f);
            f.Initialize();

            // Test process initiator conversations
            ConnectToChatInitiator test1 = f.CreateFromConversationType <ConnectToChatInitiator>();

            Assert.IsNotNull(test1);
            test1.RemoteEndPoint = testEndpoint;
            test1.Launch();
            Assert.AreEqual(test1.RemoteEndPoint, testEndpoint);
            // What to assert on launch? Ask in code review

            ListServersRequestInitiator test2 = f.CreateFromConversationType <ListServersRequestInitiator>();

            Assert.IsNotNull(test2);
            test2.RemoteEndPoint = testEndpoint;
            test2.Launch();
            Assert.AreEqual(test2.RemoteEndPoint, testEndpoint);

            LoginRequestInitiator test3 = f.CreateFromConversationType <LoginRequestInitiator>();

            Assert.IsNotNull(test3);
            test3.RemoteEndPoint = testEndpoint;
            test3.Launch();
            Assert.AreEqual(test3.RemoteEndPoint, testEndpoint);

            PublicKeysRequestInitiator test4 = f.CreateFromConversationType <PublicKeysRequestInitiator>();

            Assert.IsNotNull(test4);
            test4.RemoteEndPoint = testEndpoint;
            test4.Launch();
            Assert.AreEqual(test4.RemoteEndPoint, testEndpoint);

            RegisterKeyRequestInitiator test5 = f.CreateFromConversationType <RegisterKeyRequestInitiator>();

            Assert.IsNotNull(test5);
            test5.RemoteEndPoint = testEndpoint;
            test5.Launch();
            Assert.AreEqual(test5.RemoteEndPoint, testEndpoint);


            // Test process responder conversations
            //   There are none to test
        }