Package net.i2p.sam.client
Class SAMEventHandler
java.lang.Object
net.i2p.sam.client.SAMClientEventListenerImpl
net.i2p.sam.client.SAMEventHandler
- All Implemented Interfaces:
SAMReader.SAMClientEventListener
Simple helper implementation of a the SAMClientEventListener
-
Field Summary
Fields inherited from interface net.i2p.sam.client.SAMReader.SAMClientEventListener
NAMING_REPLY_INVALID_KEY, NAMING_REPLY_KEY_NOT_FOUND, NAMING_REPLY_OK, SESSION_STATUS_DUPLICATE_DEST, SESSION_STATUS_I2P_ERROR, SESSION_STATUS_INVALID_KEY, SESSION_STATUS_OK, STREAM_CLOSED_CANT_REACH_PEER, STREAM_CLOSED_I2P_ERROR, STREAM_CLOSED_OK, STREAM_CLOSED_PEER_NOT_FOUND, STREAM_CLOSED_TIMEOUT, STREAM_STATUS_CANT_REACH_PEER, STREAM_STATUS_I2P_ERROR, STREAM_STATUS_INVALID_KEY, STREAM_STATUS_OK, STREAM_STATUS_TIMEOUT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhelloReplyReceived(boolean ok, String version) voidnamingReplyReceived(String name, String result, String value, String msg) voidsessionStatusReceived(String result, String destination, String msg) may be called twice, first for CREATE and second for ADDvoidstreamStatusReceived(String result, String id, String message) voidunknownMessageReceived(String major, String minor, Properties params) Wait for the connection to be established, returning the server version if everything went okwaitForNamingReply(String name) Return the destination found matching the name, or null if the key was not able to be retrieved.booleanWait for the session to be added, returning true if everything went okbooleanWait for the session to be created, returning true if everything went okbooleanWait for the stream to be created, returning true if everything went okMethods inherited from class net.i2p.sam.client.SAMClientEventListenerImpl
datagramReceived, destReplyReceived, pingReceived, pongReceived, rawReceived, streamClosedReceived, streamConnectedReceived, streamDataReceived
-
Constructor Details
-
SAMEventHandler
-
-
Method Details
-
helloReplyReceived
- Specified by:
helloReplyReceivedin interfaceSAMReader.SAMClientEventListener- Overrides:
helloReplyReceivedin classSAMClientEventListenerImpl
-
sessionStatusReceived
may be called twice, first for CREATE and second for ADD- Specified by:
sessionStatusReceivedin interfaceSAMReader.SAMClientEventListener- Overrides:
sessionStatusReceivedin classSAMClientEventListenerImpl
-
namingReplyReceived
- Specified by:
namingReplyReceivedin interfaceSAMReader.SAMClientEventListener- Overrides:
namingReplyReceivedin classSAMClientEventListenerImpl
-
streamStatusReceived
- Specified by:
streamStatusReceivedin interfaceSAMReader.SAMClientEventListener- Overrides:
streamStatusReceivedin classSAMClientEventListenerImpl
-
unknownMessageReceived
- Specified by:
unknownMessageReceivedin interfaceSAMReader.SAMClientEventListener- Overrides:
unknownMessageReceivedin classSAMClientEventListenerImpl
-
waitForHelloReply
Wait for the connection to be established, returning the server version if everything went ok- Returns:
- SAM server version if everything ok, or null on failure
-
waitForSessionCreateReply
public boolean waitForSessionCreateReply()Wait for the session to be created, returning true if everything went ok- Returns:
- true if everything ok
-
waitForSessionAddReply
public boolean waitForSessionAddReply()Wait for the session to be added, returning true if everything went ok- Returns:
- true if everything ok
- Since:
- 0.9.25
-
waitForStreamStatusReply
public boolean waitForStreamStatusReply()Wait for the stream to be created, returning true if everything went ok- Returns:
- true if everything ok
-
waitForNamingReply
Return the destination found matching the name, or null if the key was not able to be retrieved.- Parameters:
name- name to be looked for, or "ME"- Returns:
- destination found matching the name, or null
-