net.i2p.i2ptunnel

## Class I2PTunnelOutproxyRunner

- java.lang.Object
- - java.lang.Thread
  - - net.i2p.util.I2PThread
    - - net.i2p.util.I2PAppThread
      - - net.i2p.i2ptunnel.I2PTunnelOutproxyRunner

- All Implemented Interfaces:
    Runnable

      public class I2PTunnelOutproxyRunner
      extends I2PAppThread

  I2PTunnelOutproxyRunner forwards data bidirectionally between two connected sockets: one representing an external socket connection and the other an I2P socket connection. It continuously transfers data until either side closes the connection or an error occurs. The class manages two internal forwarding threads to handle each direction of the data flow, maintains counters of bytes sent and received, and allows optional initial data to be sent on either socket upon startup. A user-provided callback can be invoked if no data (beyond initial data) is received before the connection closes, enabling handling of timeouts or failures. This class is designed for internal use within the I2P tunnel infrastructure and is not maintained as a stable public API.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.i2p.util.I2PThread

      `I2PThread.OOMEventListener`

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `Thread.State, Thread.UncaughtExceptionHandler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Log` | `_log`

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2PTunnelOutproxyRunner(Socket s, Socket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, I2PTunnelRunner.FailCallback onTimeout)` Constructs the OutproxyRunner Does not start itself.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `errorOccurred()` Called to signal an error occurred and notify waiting threads.
    `protected InputStream` | `getSocketIn()`
    `protected OutputStream` | `getSocketOut()`
    `long` | `getStartedOn()` Get when this runner started transferring data
    `void` | `run()`

    - ### Methods inherited from class net.i2p.util.I2PAppThread

      `addOOMEventThreadListener, fireOOM, removeOOMEventThreadListener`

    - ### Methods inherited from class net.i2p.util.I2PThread

      `addOOMEventListener, removeOOMEventListener, start`

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

      `activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield`

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

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

- - ### Field Detail

    - #### _log

          protected final Log _log

  - ### Constructor Detail

    - #### I2PTunnelOutproxyRunner

          public I2PTunnelOutproxyRunner(Socket s,
                                         Socket i2ps,
                                         Object slock,
                                         byte[] initialI2PData,
                                         byte[] initialSocketData,
                                         I2PTunnelRunner.FailCallback onTimeout)

      Constructs the OutproxyRunner Does not start itself. Caller must call start().
      Parameters:
        `s` - external socket connection
        `i2ps` - I2P socket connection
        `slock` - socket lock object, non-null
        `initialI2PData` - initial data to send to I2P side, nullable
        `initialSocketData` - initial data to send to socket side, nullable
        `onTimeout` - fail callback if no data received (except initial), nullable

  - ### Method Detail

    - #### errorOccurred

          public void errorOccurred()

      Called to signal an error occurred and notify waiting threads.

    - #### getSocketIn

          protected InputStream getSocketIn()
                                     throws IOException

      Throws:
        `IOException`

    - #### getSocketOut

          protected OutputStream getSocketOut()
                                       throws IOException

      Throws:
        `IOException`

    - #### getStartedOn

          public long getStartedOn()

      Get when this runner started transferring data
      Returns:
        timestamp in ms

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`
      Overrides:
        `run` in class `I2PThread`