## 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
`SAMEventHandler(I2PAppContext ctx)`

Method Summary
`void` `helloReplyReceived(boolean ok)`
`void` `namingReplyReceived(String name, String result, String value, String msg)`
`void` `sessionStatusReceived(String result, String destination, String msg)`
`void` `unknownMessageReceived(String major, String minor, Properties params)`
`boolean` `waitForHelloReply()` Wait for the connection to be established, returning true if everything went ok
`String` `waitForNamingReply(String name)` Return the destination found matching the name, or null if the key was not able to be retrieved.
`boolean` `waitForSessionCreateReply()` Wait for the session to be created, returning true if everything went ok

Methods inherited from class net.i2p.sam.client.SAMClientEventListenerImpl
`destReplyReceived, streamClosedReceived, streamConnectedReceived, streamDataReceived, streamStatusReceived`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SAMEventHandler

    public SAMEventHandler(I2PAppContext ctx)

Method Detail

### helloReplyReceived

    public void helloReplyReceived(boolean ok)

  Specified by:
    `helloReplyReceived` in interface `SAMReader.SAMClientEventListener`
  Overrides:
    `helloReplyReceived` in class `SAMClientEventListenerImpl`

### sessionStatusReceived

    public void sessionStatusReceived(String result,
                                      String destination,
                                      String msg)

  Specified by:
    `sessionStatusReceived` in interface `SAMReader.SAMClientEventListener`
  Overrides:
    `sessionStatusReceived` in class `SAMClientEventListenerImpl`

### namingReplyReceived

    public void namingReplyReceived(String name,
                                    String result,
                                    String value,
                                    String msg)

  Specified by:
    `namingReplyReceived` in interface `SAMReader.SAMClientEventListener`
  Overrides:
    `namingReplyReceived` in class `SAMClientEventListenerImpl`

### unknownMessageReceived

    public void unknownMessageReceived(String major,
                                       String minor,
                                       Properties params)

  Specified by:
    `unknownMessageReceived` in interface `SAMReader.SAMClientEventListener`
  Overrides:
    `unknownMessageReceived` in class `SAMClientEventListenerImpl`

### waitForHelloReply

    public boolean waitForHelloReply()

  Wait for the connection to be established, returning true if everything went ok

  Returns:
    true if everything ok

### waitForSessionCreateReply

    public boolean waitForSessionCreateReply()

  Wait for the session to be created, returning true if everything went ok

  Returns:
    true if everything ok

### waitForNamingReply

    public String waitForNamingReply(String name)

  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