|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ws.util.test.PortListen
Single-message HTTP listener. When this object is instantiated, it will spawn
a thread and listen for a message on the specified port. Call
waitForIncomingMessage()
to block, waiting for the message.
Constructor Summary | |
PortListen(int port,
int timeout)
Instantiates the object and immediately begins listening for a message. |
Method Summary | |
protected void |
getIncomingMessage(int port,
int timeout,
java.lang.StringBuffer retIncomingMessage)
Listens for an incoming TCP/IP message. |
static void |
main(java.lang.String[] args)
DOCUMENT_ME |
java.lang.String |
waitForIncomingMessage()
Waits for the incoming message. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PortListen(int port, int timeout)
port
- the port to listen to; a value of 0
creates a socket on any free porttimeout
- the time (in milliseconds) the socket accept() will wait for an incoming connection;
a value of 0
indicates accept() should wait infinitelyMethod Detail |
public static void main(java.lang.String[] args)
args
- DOCUMENT_MEpublic java.lang.String waitForIncomingMessage()
protected void getIncomingMessage(int port, int timeout, java.lang.StringBuffer retIncomingMessage) throws java.lang.IllegalArgumentException
retIncomingMessage
string buffer and notify
on that string buffer will be called to let
the caller know that it is ready.
The incoming message string buffer must be non-null
and must be empty.
If an error occurs, the string buffer will be filled with the string "ERROR:" followed by the exception message.
Even on an error, notify
will be called to let the caller know that something happened.
Note that this method does not block - it spawns a thread to perform the listening and returns immediately.
This will return an HTTP server-like response back to the client.
port
- the port to listen totimeout
- the time (in milliseconds) the socket accept() will wait for an incoming connectionretIncomingMessage
- the incoming message to be returned to the caller - this buffer will be filled in and
notify
will be called on it to let the caller know that it is ready
java.lang.IllegalArgumentException
- if the given buffer was null
or not empty
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |