I have functional tests that test a system that makes HTTP connections to some internal mock HTTP servers. By mock I mean they are real servers, just implemented by myself to simulate actual 3rd party servers. They are in java, using jetty.
So far to test for when these HTTP servers are down, I have been stopping the mock servers before starting the test, and starting them back up. This works fine but it is now getting in the way of making the tests run in parallel.
The mock HTTP servers reply differently or don't reply, based on the request.
My question is, is there a way to make the mock HTTP servers refuse some connections, for example based on the request?
I guess this is specific to Jetty, but I'm happy using another library if that's needed.