public static void TestWHIPServer_Start_Stop_Start_DoesntThrow() { LOG.Info($"Executing {nameof(TestWHIPServer_Start_Stop_Start_DoesntThrow)}"); using (var server = new WHIPServer( (req, respHandler, context) => { }, DEFAULT_ADDRESS, DEFAULT_PORT, DEFAULT_PASSWORD, DEFAULT_BACKLOG_LENGTH )) { using (var timeout = new System.Threading.Timer( state => server.Stop(), null, TimeSpan.FromMilliseconds(200), TimeSpan.FromMilliseconds(-1) // No repeat )) { server.Start(); } using (var timeout = new System.Threading.Timer( state => server.Stop(), null, TimeSpan.FromMilliseconds(200), TimeSpan.FromMilliseconds(-1) // No repeat )) { Assert.DoesNotThrow(server.Start); } } }
public static void TestWHIPServer_Stop_TwiceAfterStarted_DoesntThrow() { LOG.Info($"Executing {nameof(TestWHIPServer_Start_DoesntThrow)}"); using (var server = new WHIPServer( (req, respHandler, context) => { }, DEFAULT_ADDRESS, DEFAULT_PORT, DEFAULT_PASSWORD, DEFAULT_BACKLOG_LENGTH )) using (var task = new Task(server.Start)) { task.Start(); System.Threading.Thread.Sleep(200); server.Stop(); System.Threading.Thread.Sleep(600); Assert.DoesNotThrow(server.Stop); } }