## net.i2p.i2ptunnel
Class I2PTunnelRunner

    java.lang.Object
      java.lang.Thread
          net.i2p.util.I2PThread
              net.i2p.i2ptunnel.I2PTunnelRunner

All Implemented Interfaces:
  java.lang.Runnable, I2PSocket.SocketErrorListener

Direct Known Subclasses:
  I2PTunnelHTTPClientRunner

    public class I2PTunnelRunner

extends I2PThread
implements I2PSocket.SocketErrorListener

Nested Class Summary

Nested classes/interfaces inherited from class net.i2p.util.I2PThread
`I2PThread.OOMEventListener`

Nested classes/interfaces inherited from class java.lang.Thread
`java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

Field Summary
`(package private) boolean` `finished`
`(package private) java.lang.Object` `finishLock`
`(package private) byte[]` `initialI2PData`
`(package private) byte[]` `initialSocketData`
`(package private) static int` `MAX_PACKET_SIZE` max bytes streamed in a packet - smaller ones might be filled up to this size.
`(package private) static int` `NETWORK_BUFFER_SIZE`
`(package private) java.util.HashMap` `ostreams`
`(package private) java.lang.Object` `slock`
`(package private) java.util.HashMap` `sockets`

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`I2PTunnelRunner(java.net.Socket s, I2PSocket i2ps, java.lang.Object slock, byte[] initialI2PData, byte[] initialSocketData, java.util.List sockList)`
`I2PTunnelRunner(java.net.Socket s, I2PSocket i2ps, java.lang.Object slock, byte[] initialI2PData, byte[] initialSocketData, java.util.List sockList, java.lang.Runnable onTimeout)`
`I2PTunnelRunner(java.net.Socket s, I2PSocket i2ps, java.lang.Object slock, byte[] initialI2PData, java.util.List sockList)`
`I2PTunnelRunner(java.net.Socket s, I2PSocket i2ps, java.lang.Object slock, byte[] initialI2PData, java.util.List sockList, java.lang.Runnable onTimeout)`

Method Summary
`protected void` `close(java.io.OutputStream out, java.io.InputStream in, java.io.OutputStream i2pout, java.io.InputStream i2pin, java.net.Socket s, I2PSocket i2ps, java.lang.Thread t1, java.lang.Thread t2)`
`void` `errorOccurred()` An error occurred communicating with the peer.
`long` `getLastActivityOn()` When was the last data for this runner sent or received?
`protected java.io.InputStream` `getSocketIn()`
`protected java.io.OutputStream` `getSocketOut()`
`long` `getStartedOn()` When this runner started up transferring data
`boolean` `isFinished()` have we closed at least one (if not both) of the streams [aka we're done running the streams]?
`void` `run()`

Methods inherited from class net.i2p.util.I2PThread
`addOOMEventListener, finalize, main, removeOOMEventListener`

Methods inherited from class java.lang.Thread

`activeCount, checkAccess, 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, start, stop, stop, suspend, toString, yield`

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

Field Detail

### MAX_PACKET_SIZE

    static int MAX_PACKET_SIZE

  max bytes streamed in a packet - smaller ones might be filled up to this size. Larger ones are not split (at least not on Sun's impl of BufferedOutputStream), but that is the streaming api's job...

### NETWORK_BUFFER_SIZE

    static final int NETWORK_BUFFER_SIZE

### slock

    java.lang.Object slock

### finishLock

    java.lang.Object finishLock

### finished

    boolean finished

### ostreams

    java.util.HashMap ostreams

### sockets

    java.util.HashMap sockets

### initialI2PData

    byte[] initialI2PData

### initialSocketData

    byte[] initialSocketData

Constructor Detail

### I2PTunnelRunner

    public I2PTunnelRunner(java.net.Socket s,
                           I2PSocket i2ps,
                           java.lang.Object slock,
                           byte[] initialI2PData,
                           java.util.List sockList)

### I2PTunnelRunner

    public I2PTunnelRunner(java.net.Socket s,
                           I2PSocket i2ps,
                           java.lang.Object slock,
                           byte[] initialI2PData,
                           byte[] initialSocketData,
                           java.util.List sockList)

### I2PTunnelRunner

    public I2PTunnelRunner(java.net.Socket s,
                           I2PSocket i2ps,
                           java.lang.Object slock,
                           byte[] initialI2PData,
                           java.util.List sockList,
                           java.lang.Runnable onTimeout)

### I2PTunnelRunner

    public I2PTunnelRunner(java.net.Socket s,
                           I2PSocket i2ps,
                           java.lang.Object slock,
                           byte[] initialI2PData,
                           byte[] initialSocketData,
                           java.util.List sockList,
                           java.lang.Runnable onTimeout)

Method Detail

### isFinished

    public boolean isFinished()

  have we closed at least one (if not both) of the streams [aka we're done running the streams]?

### getLastActivityOn

    public long getLastActivityOn()

  When was the last data for this runner sent or received?

  Returns:
    date (ms since the epoch), or -1 if no data has been transferred yet

### getStartedOn

    public long getStartedOn()

  When this runner started up transferring data

### getSocketIn

    protected java.io.InputStream getSocketIn()
                                       throws java.io.IOException

  Throws:
    `java.io.IOException`

### getSocketOut

    protected java.io.OutputStream getSocketOut()
                                         throws java.io.IOException

  Throws:
    `java.io.IOException`

### run

    public void run()

  Specified by:
    `run` in interface `java.lang.Runnable`
  Overrides:
    `run` in class `I2PThread`

### close

    protected void close(java.io.OutputStream out,
                         java.io.InputStream in,
                         java.io.OutputStream i2pout,
                         java.io.InputStream i2pin,
                         java.net.Socket s,
                         I2PSocket i2ps,
                         java.lang.Thread t1,
                         java.lang.Thread t2)
                  throws java.lang.InterruptedException,
                         java.io.IOException

  Throws:
    `java.lang.InterruptedException`
    `java.io.IOException`

### errorOccurred

    public void errorOccurred()

  Description copied from interface: `I2PSocket.SocketErrorListener`
  An error occurred communicating with the peer.

  Specified by:
    `errorOccurred` in interface `I2PSocket.SocketErrorListener`