Beispiel #1
0
        internal void AddContact()
        {
            using (var node2 = new Node(65432, null))
            {
                var kademlia2 = node2.Kademlia;

                node.Start();
                node2.Start();

                kademlia.AddNode(new IPEndPoint(IPAddress.Loopback, 65432));
                Thread.Sleep(TestParameters.LocalhostCommunicationTimeout);

                Assert.AreEqual(1, kademlia.CurrentContactCount);
                Assert.AreEqual(1, kademlia2.CurrentContactCount);
            }
        }
        internal void PrepareKademlia()
        {
            node = new Node(null);
            kademlia = node.Kademlia;

            node2 = new Node(12345, null);
            kademlia2 = node.Kademlia;

            targetEndPoint = new IPEndPoint(IPAddress.Loopback, 12345);
            targetId = node2.Id;

            node.Start();
            node2.Start();

            kademlia.AddNode(new IPEndPoint(IPAddress.Loopback, 12345));
            Thread.Sleep(TestParameters.LocalhostCommunicationTimeout);
        }
Beispiel #3
0
        internal void CreateNodes()
        {
            KyruTimer.Reset();

            nodeA = new KyruApplication(12345).Node;
            nodeB = new KyruApplication(12346).Node;
            nodeC = new KyruApplication(12347).Node;

            nodeAInfo = new NodeInformation(new IPEndPoint(IPAddress.Loopback, 12345), nodeA.Id);
            nodeBInfo = new NodeInformation(new IPEndPoint(IPAddress.Loopback, 12346), nodeB.Id);
            nodeCInfo = new NodeInformation(new IPEndPoint(IPAddress.Loopback, 12347), nodeC.Id);

            nodeA.Start();
            nodeB.Start();
            nodeC.Start();

            nodeA.Kademlia.AddNode(nodeBInfo.EndPoint);
            nodeC.Kademlia.AddNode(nodeBInfo.EndPoint);

            KyruTimer.Start();

            Thread.Sleep(TestParameters.LocalhostCommunicationTimeout);
        }