Hi Tom,
The scenario is as below:
* The system under test (SUT) is a rest server owning some resource
* An api is exposed on the rest server to update the resource
* Before updating the resource, the server must authenticate the user making the request
* Wiremock is used to mock the authentication server (which again exposes Rest apis)
* There is a BDD test to validate the behavior when the dependent service is down
* At the start of the test (JUnit Before), the wiremock server is stopped using Wiremockserver.stop() -> This call seems to be synchronous as it does a JettyServer.stop and also join waiting for all Threads in Threadloop to shutdown to ensure no more incoming connections are entertained
* At the end of the test the server is started again, using mockserver.start()
* In the test, the behavior is checked by invoking the update api using Spring's RestTemplate
* When the api is invoked, the service internal makes a call to the dependent server and in this case, intermittently, though the server is down, the call to authentication server is never returned
* the client (resttemplate of unit test in this case), does not receive any response from the server for 30 seconds and thus returns a 503 - stating service unavailable