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
public class SAMEventHandler extends SAMClientEventListenerImpl
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 Constructor Description SAMEventHandler(I2PAppContext ctx) -
Method Summary
Modifier and Type Method Description voidhelloReplyReceived(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)StringwaitForHelloReply()Wait for the connection to be established, returning the server version if everything went okStringwaitForNamingReply(String name)Return the destination found matching the name, or null if the key was not able to be retrieved.booleanwaitForSessionAddReply()Wait for the session to be added, returning true if everything went okbooleanwaitForSessionCreateReply()Wait for the session to be created, returning true if everything went okbooleanwaitForStreamStatusReply()Wait 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
-
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
-