Hi all, do you know if there is a way to check tha...
# wiremock-java
s
Hi all, do you know if there is a way to check that 2 responses are done through the same HTTP connection (it is to test that keep-alive is well managed by my client) ?
t
Interesting question. Unfortunately the short answer is no at the moment. There may be other ways you can achieve a similar effect (by writing some code) e.g. exporting connection metrics from WireMock’s Jetty server, running the same test a few times then checking that the count of connections created is as you’d expect. You might equally do something like this in the caller if you’re able to instrument your HTTP client.
s
Could be an interesting option, do you know where I can find documentation or example to get wiremock server metrics ?
t
There’s a Jetty class called
StatisticsHandler
which wraps your main handler. This collects connection counts (amongst other things) so you could create your own
HttpServerFactory
that wraps the mock service handler with one of these and exposes the stats somehow so that you can retrieve them in your tests.