Mock Net Services 4 Java

When someone wants to implement network services like accessing documents on a webserver or sending mails to a SMTP server and polling mails from a POP3 server its a common problem to test this funcionallity within unittests. Some developement environments may not have access to appropriate life systems. Also it's not allways applicapable to install and maintain complete server instances for the services needed. And finally no one wants unittests to interfear with production systems.

This package tries to fill this gab by providing services that work out of the box without any installation or complex configuration. (Ok, https needs an appropriate key pair to run...) All configuration that's needed can be done by calling specialized methods on the mock server objects. Also the mock server objects provide methods to gain information about the service call. This way the unittest can verify the transmittet data directly instead of interpreting the servers response. For instance you can use the MockHttpServer without any configuration and then get the Liste of requests received by the MockHttpServer instance and check, if the URI was constructed correctly.

But you can also use each server class as a stand allone server. Each class comes with a main method to start a server instance. This main method takes two optional numeric parameter:

parameter one
If present this prameter tells the server instance on which port you want it to listen to. Therefor this parameter mut be a positive integer value less than 65536. Please note that your system may prevent you to use a port numer less than 1024.
Eache class has its own default value. In any case the port number on wch the instance is really listen to is pinted to log4j log devices (usually stdout).
parameter two
This prameter tells the server instance how many seconds do you want the server to be running. If present the server instance will shutdown after the specified number of seconds has elapsed (open connections will end normally).
This number must be a positive integer less than Long.MAX_VALUE/1000. If not present the server instance will run infinitly, meaning you have to kill the JVM it is running in.

The package provides 4 server instances:

Timothy Truckle
I'm a truckle but I don't like to truckle [Gerd Prokopp, "Wer stielt schon Unterschenkel"]