## net.i2p.sam
Class SAMMessageSession.SAMMessageSessionHandler

    java.lang.Object
      net.i2p.sam.SAMMessageSession.SAMMessageSessionHandler

All Implemented Interfaces:
  Runnable, I2PSessionListener

Enclosing class:
  SAMMessageSession

    public class SAMMessageSession.SAMMessageSessionHandler

extends Object
implements Runnable, I2PSessionListener

SAM message-based session handler, running in its own thread

Author:
  human

Constructor Summary
`SAMMessageSession.SAMMessageSessionHandler(InputStream destStream, Properties props)` Create a new SAM message-based session handler

Method Summary
`void` `disconnected(I2PSession session)` Notify the client that the session has been terminated
`void` `errorOccurred(I2PSession session, String message, Throwable error)` Notify the client that some error occurred
`void` `messageAvailable(I2PSession session, int msgId, long size)` Instruct the client that the given session has received a message with size # of bytes.
`void` `reportAbuse(I2PSession session, int severity)` Instruct the client that the session specified seems to be under attack and that the client may wish to move its destination to another router.
`void` `run()`
`void` `stopRunning()` Stop a SAM message-based session handling thread

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

Constructor Detail

### SAMMessageSession.SAMMessageSessionHandler

    public SAMMessageSession.SAMMessageSessionHandler(InputStream destStream,
                                                      Properties props)
                                               throws I2PSessionException

  Create a new SAM message-based session handler

  Parameters:
    `destStream` - Input stream containing the destination keys
    `props` - Properties to setup the I2P session
  Throws:
    `I2PSessionException`

Method Detail

### stopRunning

    public final void stopRunning()

  Stop a SAM message-based session handling thread

### run

    public void run()

  Specified by:
    `run` in interface `Runnable`

### disconnected

    public void disconnected(I2PSession session)

  Description copied from interface: `I2PSessionListener`
  Notify the client that the session has been terminated

  Specified by:
    `disconnected` in interface `I2PSessionListener`

### errorOccurred

    public void errorOccurred(I2PSession session,
                              String message,
                              Throwable error)

  Description copied from interface: `I2PSessionListener`
  Notify the client that some error occurred

  Specified by:
    `errorOccurred` in interface `I2PSessionListener`
    `error` - can be null? or not?

### messageAvailable

    public void messageAvailable(I2PSession session,
                                 int msgId,
                                 long size)

  Description copied from interface: `I2PSessionListener`
  Instruct the client that the given session has received a message with size # of bytes. After this is called, the client should call receiveMessage(msgId). There is currently no method for the client to reject the message. If the client does not call receiveMessage() within a timeout period (currently 30 seconds), the session will delete the message and log an error.

  Specified by:
    `messageAvailable` in interface `I2PSessionListener`
  Parameters:
    `session` - session to notify
    `msgId` - message number available
    `size` - size of the message - why it's a long and not an int is a mystery

### reportAbuse

    public void reportAbuse(I2PSession session,
                            int severity)

  Description copied from interface: `I2PSessionListener`
  Instruct the client that the session specified seems to be under attack and that the client may wish to move its destination to another router. Unused. Not fully implemented.

  Specified by:
    `reportAbuse` in interface `I2PSessionListener`
  Parameters:
    `session` - session to report abuse to
    `severity` - how bad the abuse is