EmbeddedJettyProbe is a small tool for examining the contents of HttpRequests that arrive at an embedded Jetty instance. This is useful for tests that need to validate the behavior of an http client. For example (scala):
In the above example requestArrivingAtServer has 2 properties: body and headers which contain the data from the HttpRequest arriving at the server. You can for example check the request body using:
It uses an ArrayBlockingQueue as a means to pass the incoming request between the Jetty request handler thread and the test thread.
This post was written by Sagy Rozman
You can follow him on Twitter