Class PseudoServer
java.lang.Object
com.meterware.pseudoserver.PseudoServer
A basic simulated web-server for testing user agents without a web server.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResourceHeader(String name, String header) Adds a header to a defined resource.intReturns the port on which this server is listening.static intReturns the amount of time the pseudo server will wait for a server socket to be released (in msec) before allocating a new one.static intReturns the number of server sockets that must have been allocated and not returned before waiting for one to be returned.voidmapToClasspath(String directory) voidsetCharacterSet(String name, String characterSet) Specifies the character set encoding for a resource.voidsetDebug(boolean debug) voidsetErrorResource(String name, int errorCode, String errorMessage) Defines a resource which will result in an error message.voidsetMaxProtocolLevel(int majorLevel, int minorLevel) voidsetResource(String name, byte[] value, String contentType) Defines the contents of an expected resource.voidsetResource(String name, PseudoServlet servlet) Defines the contents of an expected resource.voidsetResource(String name, String value) Defines the contents of an expected resource.voidsetResource(String name, String value, String contentType) Defines the contents of an expected resource.voidsetSendCharacterSet(String name, boolean enabled) Enables the sending of the character set in the content-type header.static voidsetSocketReleaseWaitTime(int socketReleaseWaitTime) Returns the amount of time the pseudo server will wait for a server socket to be released (in msec) before allocating a new one.static voidsetWaitThreshhold(int waitThreshhold) Specifies the number of server sockets that must have been allocated and not returned before waiting for one to be returned.voidshutDown()
-
Constructor Details
-
PseudoServer
public PseudoServer() -
PseudoServer
public PseudoServer(int socketTimeout)
-
-
Method Details
-
getSocketReleaseWaitTime
public static int getSocketReleaseWaitTime()Returns the amount of time the pseudo server will wait for a server socket to be released (in msec) before allocating a new one. See alsogetWaitThreshhold. -
setSocketReleaseWaitTime
public static void setSocketReleaseWaitTime(int socketReleaseWaitTime) Returns the amount of time the pseudo server will wait for a server socket to be released (in msec) before allocating a new one. See alsogetWaitThreshhold. -
getWaitThreshhold
public static int getWaitThreshhold()Returns the number of server sockets that must have been allocated and not returned before waiting for one to be returned. -
setWaitThreshhold
public static void setWaitThreshhold(int waitThreshhold) Specifies the number of server sockets that must have been allocated and not returned before waiting for one to be returned. -
shutDown
public void shutDown() -
setMaxProtocolLevel
public void setMaxProtocolLevel(int majorLevel, int minorLevel) -
getConnectedPort
Returns the port on which this server is listening.- Throws:
IOException
-
setResource
-
setResource
Defines the contents of an expected resource. -
setResource
-
setResource
-
setErrorResource
-
setSendCharacterSet
Enables the sending of the character set in the content-type header. -
setCharacterSet
-
addResourceHeader
-
mapToClasspath
-
setDebug
public void setDebug(boolean debug)
-