Skip to content
Advertisement

Is it possible to simulate connection timeout using wiremock tools?

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

Advertisement

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)

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement