public class I2PTunnelHTTPClientRunner extends I2PTunnelRunner
This class is internal and not part of a stable public API.
Implements proper resource cleanup, supports optional keep-alive for both I2P and browser sockets, and uses background threading for non-blocking socket closure when appropriate.
Thread Safety: This class is not thread-safe. It is expected to be used by a single connection thread.
I2PTunnelRunner.FailCallback, I2PTunnelRunner.SuccessCallbackI2PThread.OOMEventListenerThread.State, Thread.UncaughtExceptionHandler_keepAliveI2P, _keepAliveSocket, _log, MAX_PACKET_SIZE, NETWORK_BUFFER_SIZEMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
I2PTunnelHTTPClientRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
List<I2PSocket> sockList,
I2PTunnelRunner.FailCallback onFail,
boolean allowKeepAliveI2P,
boolean allowKeepAliveSocket,
boolean isHead)
Constructs a new HTTP client runner.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
close(OutputStream out,
InputStream in,
OutputStream i2pout,
InputStream i2pin,
Socket s,
I2PSocket i2ps,
Thread t1,
Thread t2)
Closes all streams and sockets, respecting keep-alive settings.
|
protected OutputStream |
getSocketOut()
Returns a filtered HTTP response OutputStream that enforces the "Connection: close" header.
|
getKeepAliveI2P, getKeepAliveSocket, getSocketIn, getStartedOn, run, setSuccessCallback, streamDoneaddOOMEventThreadListener, fireOOM, removeOOMEventThreadListeneraddOOMEventListener, removeOOMEventListener, startactiveCount, 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, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waiterrorOccurredpublic I2PTunnelHTTPClientRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, List<I2PSocket> sockList, I2PTunnelRunner.FailCallback onFail, boolean allowKeepAliveI2P, boolean allowKeepAliveSocket, boolean isHead)
s - local socket (browser side)i2ps - connected I2P socketslock - synchronization lock for shared resourcesinitialI2PData - initial data to send over I2PsockList - list of active I2P socketsonFail - callback for failure eventsallowKeepAliveI2P - if true, optionally keep I2P socket alive after responseallowKeepAliveSocket - if true, optionally keep browser socket alive after responseisHead - true if responding to an HTTP HEAD request (no body expected)IllegalArgumentException - if keep-alive I2P is requested but browser socket keep-alive is disabledprotected void close(OutputStream out, InputStream in, OutputStream i2pout, InputStream i2pin, Socket s, I2PSocket i2ps, Thread t1, Thread t2) throws InterruptedException
close in class I2PTunnelRunnerout - may be nullin - may be nulli2pout - may be nulli2pin - may be nullt1 - may be nullt2 - may be null, ignored, we only join t1InterruptedExceptionprotected OutputStream getSocketOut() throws IOException
getSocketOut in class I2PTunnelRunnerIllegalStateException - if called more than onceIOException - if an I/O error occurs