Is it possible to simulate connection timeout using wiremock tools?

Tags: ,



I know that it can simulate SocketTimeoutException by using withFixedDelay, but what about ConnectionTimeoutException?

Answer

Yes it is possible to do this with WireMock by calling addDelayBeforeProcessingRequests(300) against the Java API or posting the following to http://<host>:<port>/__admin/socket-delay:

{ "milliseconds": 300 }

(Obviously replacing 300 with however many milliseconds you’d like to delay by)



Source: stackoverflow