shutdown

fun shutdown(gracePeriodMillis: Long = 500, timeoutMillis: Long = 1000)(source)

Stops the server and blocks the calling thread until shutdown is complete.

Active connections are given gracePeriodMillis milliseconds to finish before the server stops accepting new work. If connections do not close within timeoutMillis milliseconds, shutdown is forced.

Call this method in a @AfterAll (JUnit 5) or @After (JUnit 4) teardown method.

Example:

@AfterAll
void tearDown() {
mokksy.shutdown(); // gracePeriodMillis=500, timeoutMillis=1000
mokksy.shutdown(200, 400); // custom timings
}

Parameters

gracePeriodMillis

Milliseconds to wait for active connections to finish before the server stops accepting new work. Defaults to 500.

timeoutMillis

Maximum milliseconds to wait for all connections to close before forcing shutdown. Must be ≥ gracePeriodMillis. Defaults to 1000.