net.i2p.router.client

## Class ClientMessageEventListener

- java.lang.Object
- - net.i2p.router.client.ClientMessageEventListener

- All Implemented Interfaces:
    I2CPMessageReader.I2CPMessageEventListener

      class ClientMessageEventListener
      extends Object
      implements I2CPMessageReader.I2CPMessageEventListener

  Receive events from the client and handle them accordingly (updating the runner when necessary)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected RouterContext` | `_context`
    `protected ClientConnectionRunner` | `_runner`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientMessageEventListener(RouterContext context, ClientConnectionRunner runner, boolean enforceAuth)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `disconnected(I2CPMessageReader reader)` Notify the listener that the stream this reader was reading was closed.
    `protected void` | `handleCreateLeaseSet(CreateLeaseSetMessage message)` override for testing
    `protected void` | `handleDestLookup(DestLookupMessage message)` override for testing
    `protected void` | `handleGetBWLimits(GetBandwidthLimitsMessage message)` Divide router limit by 1.5 for overhead.
    `protected void` | `handleHostLookup(HostLookupMessage message)` override for testing
    `void` | `messageReceived(I2CPMessageReader reader, I2CPMessage message)` Handle an incoming message and dispatch it to the appropriate handler
    `void` | `readError(I2CPMessageReader reader, Exception error)` Handle notification that there was an error
    `protected void` | `startCreateSessionJob(SessionConfig config)` Override for testing

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

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

- - ### Field Detail

    - #### _context

          protected final RouterContext _context

    - #### _runner

          protected final ClientConnectionRunner _runner

  - ### Constructor Detail

    - #### ClientMessageEventListener

          public ClientMessageEventListener(RouterContext context,
                                            ClientConnectionRunner runner,
                                            boolean enforceAuth)

      Parameters:
        `enforceAuth` - set false for in-JVM, true for socket access

  - ### Method Detail

    - #### disconnected

          public void disconnected(I2CPMessageReader reader)

      Description copied from interface: `I2CPMessageReader.I2CPMessageEventListener`
      Notify the listener that the stream this reader was reading was closed. For most errors, readError() will be called first, as of 0.9.41
      Specified by:
        `disconnected` in interface `I2CPMessageReader.I2CPMessageEventListener`
      Parameters:
        `reader` - I2CPMessageReader to notify

    - #### handleCreateLeaseSet

          protected void handleCreateLeaseSet(CreateLeaseSetMessage message)

      override for testing

    - #### handleDestLookup

          protected void handleDestLookup(DestLookupMessage message)

      override for testing

    - #### handleGetBWLimits

          protected void handleGetBWLimits(GetBandwidthLimitsMessage message)

      Divide router limit by 1.5 for overhead. This could someday give a different answer to each client. But it's not enforced anywhere. protected for unit test override

    - #### handleHostLookup

          protected void handleHostLookup(HostLookupMessage message)

      override for testing

    - #### messageReceived

          public void messageReceived(I2CPMessageReader reader,
                                      I2CPMessage message)

      Handle an incoming message and dispatch it to the appropriate handler
      Specified by:
        `messageReceived` in interface `I2CPMessageReader.I2CPMessageEventListener`
      Parameters:
        `reader` - I2CPMessageReader to notify
        `message` - the I2CPMessage

    - #### readError

          public void readError(I2CPMessageReader reader,
                                Exception error)

      Handle notification that there was an error
      Specified by:
        `readError` in interface `I2CPMessageReader.I2CPMessageEventListener`
      Parameters:
        `reader` - I2CPMessageReader to notify
        `error` - Exception that was thrown, non-null

    - #### startCreateSessionJob

          protected void startCreateSessionJob(SessionConfig config)

      Override for testing