Is it possible to simulate connection timeout using wiremock tools?

Developer87 picture Developer87 · May 11, 2015 · Viewed 14k times · Source

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

Answer

Tom picture Tom · Aug 28, 2015

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)