private void StopIdentServer( ) { if (0 == Interlocked.Decrement(ref _identServerUseCount)) { _identServer.Stop( ); _identServer = null; } }
public void Stop_DoNotDisposeListener() { IdentServer.UserNameNeeded += (s, e) => e.UserName = "******"; var client = new TestTcpWrapper(); var listener = new TestTcpListenerWrapper(); IdentServer.Start(listener); IdentServer.Stop(false); Assert.IsFalse(listener.Disposed); }
public void Stop_DisposeListener() { IdentServer.UserNameNeeded += (s, e) => e.UserName = "******"; var client = new TestTcpWrapper(); var listener = new TestTcpListenerWrapper(); IdentServer.Start(listener); IdentServer.Stop(); listener.AddClient(client); client.ReceiveLine("0,0"); Assert.AreEqual(0, client.LinesSent.Count); Assert.IsTrue(listener.Disposed); }