...
The jetty infrastructure can be use to test servlets with an embedded server configured by the ServletTester class. The HTTP requests and responses for testing can be generated and parsed with the HttpTester class.
The embedded server uses a special local connector, and thus avoids the need to open sockets in order to test the servlet.
An example of a test harness that uses these classes is ServletTest.
...