public async Task EstablishConnection() { bool peerChange = false; transMgr.PeerChange += (object obj, PeerChangeEventArgs e) => { peerChange = true; }; string ipAddress = IPAddress.Loopback.ToString(); await transMgr.DirectConnectAsyncTCP(ipAddress); int peerCount = transMgr.KnownPeers.Count; Assert.IsTrue(peerCount > 0); Assert.IsTrue(peerChange == true); }
//This is here for existing Peer to Peer systems that use asynchronous Connections. //This method is not needed otherwise because this class automatically keeps track //of peer connections /// <summary> /// This method is avaliable to make it easier to integrate existing asymetric peer to peer systems. /// </summary> /// <param name="ipAddress">the ip address to establish a connection with</param> /// <returns></returns> public async Task DirectConnectAsyncTCP(string ipAddress) { await peerManager.DirectConnectAsyncTCP(ipAddress); }