public class StpConnection extends Object implements SocketListener
| Modifier and Type | Class and Description |
|---|---|
static class |
StpConnection.State |
| Constructor and Description |
|---|
StpConnection(SocketChannel socket,
ConnectionHandler handler,
EventHandler eventHandler,
SocketMonitor monitor)
Initializes variables in object scope, sets 'count known' to false to read byte count (STP/0).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead(SelectableChannel channel) |
boolean |
canWrite(SelectableChannel channel) |
void |
close()
Switches the wait state and wakes up the selector to process.
|
boolean |
isConnected() |
void |
parseServiceList(String message)
Processes an incoming message and passes it to event handler if needed, the following events
are to our interest:
Runtime-Started: ecmascript runtime starts in Opera (that we can inject to)
Runtime-Stopped: ecmascript runtime stops (not used, buggy)
Message: fired from console log event
Updated-Window: a window is updated OR created (opener-id=0)
Active-Window: window focus changed
Window-Closed: self explanatory If message matches none it is added to the response queue
(probably response to command).
|
void |
send(UmsProtos.Command command)
Queues up an STP/1 message sent from another thread and wakes up selector to register it to the
key.
|
void |
sendEnableStp1() |
void |
sendQuit() |
public StpConnection(SocketChannel socket, ConnectionHandler handler, EventHandler eventHandler, SocketMonitor monitor) throws IOException
IOExceptionpublic boolean isConnected()
public void send(UmsProtos.Command command)
command - to add to the request queuepublic void sendEnableStp1()
public void sendQuit()
public boolean canRead(SelectableChannel channel) throws IOException
canRead in interface SocketListenerIOExceptionpublic boolean canWrite(SelectableChannel channel) throws IOException
canWrite in interface SocketListenerIOExceptionpublic void close()
public void parseServiceList(String message)
Copyright © 2012. All Rights Reserved.