private void TestNat(Simulator sim, NatTypes n0type0, NatTypes n0type1,
NatTypes n1type0, NatTypes n1type1, bool relay)
{
string fail_s = String.Format("{0}/{1} and {2}/{3}", n0type0, n0type1,
n1type0, n1type1);
Node node0 = null;
Node node1 = null;
while(true) {
node0 = NatFactory.AddNode(sim, n0type0, n0type1, relay);
node1 = NatFactory.AddNode(sim, n1type0, n1type1, relay);
Assert.IsTrue(sim.Complete(true), fail_s + " nodes are connected to the overlay");
if(!Simulator.AreConnected(node0, node1)) {
break;
}
}
ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node0);
mco.Start();
node0.AddConnectionOverlord(mco);
mco.Set(node1.Address);
Assert.IsTrue(AreConnected(node0, node1), fail_s + " nodes were unable to connect.");
}