Save This Page
Home » cactus-1.8.0-src » org.apache.cactus.integration.ant.container » [javadoc | source]
org.apache.cactus.integration.ant.container
public final class: MockHttpServer [javadoc | source]
java.lang.Object
   org.apache.cactus.integration.ant.container.MockHttpServer

All Implemented Interfaces:
    Runnable

A very simple HTTP server that binds to a port and responds to all requests with a predefined response.
Constructor:
 public MockHttpServer(int thePort) 
Method from org.apache.cactus.integration.ant.container.MockHttpServer Summary:
expectMethod,   expectRequestCount,   expectUri,   findUnusedLocalPort,   getPort,   isStopped,   run,   setResponse,   stop,   verify
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cactus.integration.ant.container.MockHttpServer Detail:
 public  void expectMethod(String theMethod) 
    Advise the server to expect a specific HTTP method in requests.
 public  void expectRequestCount(int theRequestCount) 
    Advise the server to expect a specific number of requests.
 public  void expectUri(String theUri) 
    Advise the server to expect a specific request URI in requests.
 public static int findUnusedLocalPort(String theHost,
    int theLowest,
    int theHighest) throws IOException 
    Returns a free port number on the specified host within the given range.
 public int getPort() 
    Returns the port number the server is listening on.
 public boolean isStopped() 
    Returns whether the server is stopped (or about to stop, to be precise).
 public  void run() 
    The main server thread. The server will wait for connections until it receives a special request containing the string 'SHUTDOWN'.
 public  void setResponse(String theResponse) 
    Sets the content of the request to send back on any request.
 public  void stop() 
    Stops the server.
 public  void verify() 
    Verifies whether the requests sent to the server matched those expected.