public void SetUp() { clientConnections = new List <IConnection>(); serverConnections = new List <IConnection>(); var config = new Config { MaxConnections = ClientCount }; maxFragmentMessageSize = config.MaxReliableFragments * (config.MaxPacketSize - AckSystem.MIN_RELIABLE_FRAGMENT_HEADER_SIZE); NotifyWaitTime = config.TimeBeforeEmptyAck * 2; server = new PeerInstanceWithSocket(config); clients = new PeerInstanceWithSocket[ClientCount]; Action <IConnection> serverConnect = (conn) => serverConnections.Add(conn); server.peer.OnConnected += serverConnect; server.peer.Bind(TestEndPoint.CreateSubstitute()); for (int i = 0; i < ClientCount; i++) { clients[i] = new PeerInstanceWithSocket(config); clientConnections.Add(clients[i].peer.Connect(server.endPoint)); } UpdateAll(); }
public void SetUp() { clientConnections = new List <IConnection>(); serverConnections = new List <IConnection>(); server = new PeerInstanceWithSocket(new Config { MaxConnections = ClientCount }); clients = new PeerInstanceWithSocket[ClientCount]; Action <IConnection> serverConnect = (conn) => serverConnections.Add(conn); server.peer.OnConnected += serverConnect; server.peer.Bind(Substitute.For <EndPoint>()); for (int i = 0; i < ClientCount; i++) { clients[i] = new PeerInstanceWithSocket(); // add remotes so they can send message to each other server.socket.AddRemote(clients[i].socket); clients[i].socket.AddRemote(server.socket); clientConnections.Add(clients[i].peer.Connect(server.endPoint)); } UpdateAll(); }
public void SetUp() { server = new PeerInstanceWithSocket(new Config { MaxConnections = ClientCount }); clients = new PeerInstanceWithSocket[ClientCount]; for (int i = 0; i < ClientCount; i++) { clients[i] = new PeerInstanceWithSocket(); } }
public void SetUp() { server = new PeerInstanceWithSocket(new Config { MaxConnections = ClientCount }); clients = new PeerInstanceWithSocket[ClientCount]; for (int i = 0; i < ClientCount; i++) { clients[i] = new PeerInstanceWithSocket(); // add remotes so they can send message to each other server.socket.AddRemote(clients[i].socket); clients[i].socket.AddRemote(server.socket); } }