public final class ClientConnection extends Object
The typical usage is:
final ClientConnection connection = new ClientConnection(hostName, portNumber);
new Thread() {
void run() {
connection.runEventLoop(new ClientConnection.Listener() {
public void header(Map<String, String> properties) {
// header received
}
public void response(V8Response response) {
// response received
}
public void event(V8Event event) {
// event received
}
});
}
}.start();
...
V8Request request = Continue.createRequest(...);
connection.send(request);
Modifier and Type | Class and Description |
---|---|
static interface |
ClientConnection.Listener
Listener receiving debugger events.
|
Constructor and Description |
---|
ClientConnection(String serverName,
int serverPort)
Create a new client connection.
|
Modifier and Type | Method and Description |
---|---|
void |
addIOListener(IOListener iol)
Add an I/O listener to monitor the debugger communication.
|
void |
close()
Close the connection.
|
boolean |
isClosed()
Test whether the connection is closed.
|
void |
removeIOListener(IOListener iol)
Remove an I/O listener monitoring the communication.
|
void |
runEventLoop(ClientConnection.Listener listener)
Execute the debugger events loop.
|
void |
send(V8Request request)
Send a request to the debugger server.
|
public ClientConnection(String serverName, int serverPort) throws IOException
serverName
- the debugger server name. Can be null
to connect to localhost.serverPort
- the debugger server portIOException
- when an IO problem occurs.public void runEventLoop(ClientConnection.Listener listener) throws IOException
listener
- The listener to receive the debugger events.IOException
- thrown when an IO problem occurs.public void send(V8Request request) throws IOException
request
- The request to be sent to the debugger server.IOException
- thrown when an IO problem occurs.public void close() throws IOException
IOException
- thrown when an IO problem occurs.public boolean isClosed()
true
when the connection is already closed,
false
otherwise.public void addIOListener(IOListener iol)
iol
- an IOListenerpublic void removeIOListener(IOListener iol)
iol
- an IOListener