public void AfterTest(ITest test) { TestContext.WriteLine("Tearing down server and core webdriver"); ServerInstance?.Dispose(); ServerInstance = null; }
public void PacketFilterTest() { ServerInstance si = new ServerInstance(UOM.ServerName, false, 0, 32); ClientInstance ci = new ClientInstance(UOM.ServerName, false); ci.AddRecvFilterEvent += Ci_AddRecvFilterEvent; ci.SendPacketEvent += Ci_SendPacketEvent; si.SendCommand(Command.AddRecvFilterConditional, new PacketFilterInfo(0xFF, new PacketFilterCondition[] { new PacketFilterCondition(2, new byte[] { 0x12, 0x34, 0x56, 0x78 }, 4) }).Serialize()); byte[] packet = new byte[] { 0xFF, 0x01, 0x12, 0x34, 0x56, 0x78, }; byte[] packet2 = new byte[] { 0xFF, 0x00, 0x78, 0x56, 0x34, 0x12, }; si.SendCommand(Command.SendPacket, 0, (byte)PacketType.Server, packet); si.SendCommand(Command.SendPacket, 0, (byte)PacketType.Server, packet2); lock (m_FinishedLock) { Monitor.Wait(m_FinishedLock); } ci.Dispose(); si.Dispose(); }
public void PacketFilterTest() { ServerInstance si = new ServerInstance( UOM.ServerName, false, 0, 32 ); ClientInstance ci = new ClientInstance( UOM.ServerName, false ); ci.AddRecvFilterEvent += Ci_AddRecvFilterEvent; ci.SendPacketEvent += Ci_SendPacketEvent; si.SendCommand( Command.AddRecvFilterConditional, new PacketFilterInfo( 0xFF, new PacketFilterCondition[] { new PacketFilterCondition( 2, new byte[] { 0x12, 0x34, 0x56, 0x78 }, 4 ) } ).Serialize() ); byte[] packet = new byte[] { 0xFF, 0x01, 0x12, 0x34, 0x56, 0x78, }; byte[] packet2 = new byte[] { 0xFF, 0x00, 0x78, 0x56, 0x34, 0x12, }; si.SendCommand( Command.SendPacket, 0, (byte) PacketType.Server, packet ); si.SendCommand( Command.SendPacket, 0, (byte) PacketType.Server, packet2 ); lock (m_FinishedLock) { Monitor.Wait( m_FinishedLock ); } ci.Dispose(); si.Dispose(); }