|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.safs.sockets.AbstractProtocolRunner org.safs.android.SocketServer
public class SocketServer
This class is the "local" controller side implementation of an AbstractSocketRunner. The class provides the SocketProtocol implementation needed by the DJavaHook to communicate with the SAFS Messenger Service on an Android device or emulator.
When using the Android Emulator, the emulator must be configured to "see" Socket requests on its local port 2410 coming from the controller on port 2411. Do this with the adb forwarding command to the running emulator as follows:
adb forward tcp:2411 tcp:2410
There is an initial handshake or verification that occurs between this remote controller server and the on-device Service to confirm the device port owner is a SAFS TCP Messenger Service.
DJavaHook
,
MessengerService
,
DroidEngine
Field Summary |
---|
Fields inherited from class org.safs.sockets.AbstractProtocolRunner |
---|
_debugEnabled, protocolserver, runnerlisteners |
Constructor Summary | |
---|---|
SocketServer()
Default no-op constructor setting SocketServer to use all defaults. |
|
SocketServer(SocketServerListener listener)
Constructor setting SocketServer to use all defaults while registering a SocketServerListener. |
Method Summary | |
---|---|
void |
processProtocolMessage(java.lang.String message)
Routine called by the asynchronous run loop when a message has been received from the remote SocketProtocol. |
boolean |
sendDispatch(java.util.Properties trd)
Send the remote client a DISPATCHPROPS message containing a Serialized Properties object containing all the testRecordData and other data needed for the execution of the Dispatch. |
boolean |
sendDispatch(java.lang.String filepath)
Send the remote client a DISPATCHFILE message with the filepath to a file suitable for Properties loading. |
boolean |
sendMessage(java.lang.String message)
Send the remote client and arbitrary MESSAGE content. |
boolean |
sendShutdown()
Send the remote client a shutdown command |
Methods inherited from class org.safs.sockets.AbstractProtocolRunner |
---|
addListener, debug, getListenerName, onReceiveConnection, onReceiveDebug, onReceiveLocalShutdown, onReceiveRemoteShutdown, removeListener, run, sendProtocolMessage, setListenerName, shutdownThread |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SocketServer()
public SocketServer(SocketServerListener listener)
listener
- SocketServerListener to register with the new instance.Method Detail |
---|
public boolean sendDispatch(java.util.Properties trd)
"dispatchprops:char[]data"
Properties
- trd to serialize with properties.store
Properties.store(OutputStream, String)
,
SocketServer.notifyDispatchProps(char[])
,
MessengerService.onReceiveDispatchProps(char[])
,
DroidEngine.onRemoteDispatchProps(java.util.Properties)
public boolean sendDispatch(java.lang.String filepath)
"dispatchfile:filpath"
The remote client is expected to receive the Dispatch and forward the filepath info to the actual remote engine.
filepath
-
SocketServer.notifyDispatchFile(String)
,
MessengerService.onReceiveDispatchFile(String)
,
DroidEngine.onRemoteDispatchFile(String)
public boolean sendMessage(java.lang.String message)
The remote client is expected to forward the message to the remote engine with the "message:" prefix stripped off. These messages are NOT part of the standard SAFS protocol and it is up to the local and remote engines to know what to do with them.
message
-
SocketServer.notifyMessage(String)
,
MessengerService.onReceiveMessage(String)
,
DroidEngine.onRemoteMessage(String)
public boolean sendShutdown()
SocketServer.notifyMessage(String)
,
MessengerService.onReceiveRemoteShutdown(int)
,
DroidEngine.onRemoteShutdown()
public void processProtocolMessage(java.lang.String message)
processProtocolMessage
in class AbstractProtocolRunner
SocketServerListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |