net.i2p.client.streaming

## Class MessageHandler

- java.lang.Object
- - net.i2p.client.streaming.MessageHandler

- All Implemented Interfaces:
    I2PSessionListener

       class MessageHandler
      extends Object
      implements I2PSessionListener

  Receive raw information from the I2PSession and turn it into Packets, if we can.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MessageHandler(I2PAppContext ctx, ConnectionManager mgr)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)`
    `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` | `removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)`
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MessageHandler

          public MessageHandler(I2PAppContext ctx,
                        ConnectionManager mgr)

  - ### Method Detail

    - #### messageAvailable

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

      Instruct the client that the given session has received a message with size # of bytes.
      Specified by:
        `messageAvailable` in interface `I2PSessionListener`
      Parameters:
        `session` - session to notify
        `msgId` - message number available
        `size` - size of the message

    - #### reportAbuse

          public 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.
      Specified by:
        `reportAbuse` in interface `I2PSessionListener`
      Parameters:
        `session` - session to report abuse to
        `severity` - how bad the abuse is

    - #### disconnected

          public void disconnected(I2PSession session)

      Notify the client that the session has been terminated
      Specified by:
        `disconnected` in interface `I2PSessionListener`
      Parameters:
        `session` - that has been terminated

    - #### errorOccurred

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

      Notify the client that some error occurred
      Specified by:
        `errorOccurred` in interface `I2PSessionListener`
      Parameters:
        `session` - of the client
        `message` - to send to the client about the error
        `error` - the actual error

    - #### addDisconnectListener

          public void addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)

    - #### removeDisconnectListener

          public void removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)