internal void TestReliablity(CongestionControlBase congestionControl) { SetupMembers(); this.congestionControlBase = congestionControl; Assert.IsNotNull(congestionControlBase, "You must instantiate the congestion control base before running tests"); GenericPacketMock p1 = new GenericPacketMock(1); GenericPacketMock p2 = new GenericPacketMock(2); GenericPacketMock p3 = new GenericPacketMock(3); GenericPacketMock p4 = new GenericPacketMock(4); GenericPacketMock p5 = new GenericPacketMock(5); GenericPacketMock p6 = new GenericPacketMock(6); UInt16 expectedSeq = 1; bool triggered = false; socketMock2.InterceptIncomingPacket(packet => { Assert.IsTrue(packet.Seq == expectedSeq, String.Format("Expected packet with seq {0} and got {1} instead", expectedSeq, packet.Seq)); triggered = true; GenericPacket ackPacket = new GenericPacketMock(0); ackPacket.Ack = packet.Seq; }); tunnel.SendPacket(p1); Assert.IsTrue(triggered); }
public TunnelBase(TunnelSocket socket) { this._socket = socket; this.ID = Common.RemoveTIDFlags(BitConverter.ToUInt64(SodiumCore.GetRandomBytes(8), 0)); this.ActivePipes = new TreeDictionary <uint, PipeBase>(); this.congestionController = new NoCongestionControl(_socket, 250, 500, 1, 500); }
/// <summary> /// Initializes a new instance of the <see cref="AbstractTunnel"/> class on an /// existing abstractTunnel socket. /// </summary> /// <param name="socket">Socket.</param> /// <param name="tid">Tid.</param> public TunnelBase(TunnelSocket socket, UInt64 tid) { this._socket = socket; this.ID = tid; this.ActivePipes = new TreeDictionary <uint, PipeBase>(); this.congestionController = new NoCongestionControl(_socket, 250, 500, 1, 500); }
protected void SetupMembers() { this.socketMock1 = new TunnelSocketMock(); this.socketMock2 = new TunnelSocketMock(); this.tunnel = new TunnelMock(this.socketMock1); this.congestionControlBase = null; socketMock1.InterceptOutgoingPacket(packet => socketMock2.HandlePacket(packet)); }
internal TunnelCongestionControllerMock(CongestionControlBase congestionControl, IPacketSender socketMock) { congestionController = congestionControl; packetSender = socketMock; }