Warm tip: This article is reproduced from stackoverflow.com, please click
java wiremock

Is it possible to simulate connection timeout using wiremock tools?

发布于 2020-05-01 17:29:42

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

Questioner
Developer87
Viewed
45
Tom 2015-08-28 22:15

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)