Package net.i2p.i2ptunnel.socks
Class SocketWrapper
- java.lang.Object
- 
- net.i2p.i2ptunnel.socks.SocketWrapper
 
- 
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- I2PSocket
 
 class SocketWrapper extends Object implements I2PSocket Wrapper around the Socket obtained from the Outproxy, which is a wrapper around the Orchid Stream.- Since:
- 0.9.27
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface net.i2p.client.streaming.I2PSocketI2PSocket.SocketErrorListener
 
- 
 - 
Constructor SummaryConstructors Constructor Description SocketWrapper(Socket sock)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()SelectableChannelgetChannel()Deprecated.InputStreamgetInputStream()As of 0.9.9 will throw an IOE if socket is closed.intgetLocalPort()The local port.I2PSocketOptionsgetOptions()OutputStreamgetOutputStream()As of 0.9.9 will throw an IOE if socket is closed.DestinationgetPeerDestination()intgetPort()The remote port.longgetReadTimeout()How long we will wait blocked on a read() operation.DestinationgetThisDestination()booleanisClosed()voidreset()Just calls close()voidsetOptions(I2PSocketOptions options)Does nothingvoidsetReadTimeout(long ms)Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever).voidsetSocketErrorListener(I2PSocket.SocketErrorListener lsnr)Deprecated, unimplemented, does nothing
 
- 
- 
- 
Constructor Detail- 
SocketWrapperpublic SocketWrapper(Socket sock) 
 
- 
 - 
Method Detail- 
getThisDestinationpublic Destination getThisDestination() - Specified by:
- getThisDestinationin interface- I2PSocket
- Returns:
- the Destination of this side of the socket.
 
 - 
getPeerDestinationpublic Destination getPeerDestination() - Specified by:
- getPeerDestinationin interface- I2PSocket
- Returns:
- the destination of the peer.
 
 - 
getInputStreampublic InputStream getInputStream() throws IOException Description copied from interface:I2PSocketAs of 0.9.9 will throw an IOE if socket is closed. Prior to that would return null instead of throwing IOE.Note that operations on the returned stream may return an IOExceptionwhose cause as returned byThrowable.getCause()is anI2PSocketException. If so, the client may retrieve a status code viaI2PSocketException.getStatus()to provide specific feedback to the user.- Specified by:
- getInputStreamin interface- I2PSocket
- Returns:
- an InputStream to read from the socket. Non-null since 0.9.9.
- Throws:
- IOException- on failure
 
 - 
getOutputStreampublic OutputStream getOutputStream() throws IOException Description copied from interface:I2PSocketAs of 0.9.9 will throw an IOE if socket is closed. Prior to that would return null instead of throwing IOE.Note that operations on the returned stream may return an IOExceptionwhose cause as returned byThrowable.getCause()is anI2PSocketException. If so, the client may retrieve a status code viaI2PSocketException.getStatus()to provide specific feedback to the user.- Specified by:
- getOutputStreamin interface- I2PSocket
- Returns:
- an OutputStream to write into the socket. Non-null since 0.9.9.
- Throws:
- IOException- on failure
 
 - 
getChannel@Deprecated public SelectableChannel getChannel() Deprecated.Description copied from interface:I2PSocketUnimplemented, unlikely to ever be implemented.- Specified by:
- getChannelin interface- I2PSocket
- Returns:
- null always
 
 - 
getOptionspublic I2PSocketOptions getOptions() - Specified by:
- getOptionsin interface- I2PSocket
- Returns:
- null always
 
 - 
setOptionspublic void setOptions(I2PSocketOptions options) Does nothing- Specified by:
- setOptionsin interface- I2PSocket
- Parameters:
- options- I2PSocketOptions to set
 
 - 
getReadTimeoutpublic long getReadTimeout() Description copied from interface:I2PSocketHow long we will wait blocked on a read() operation. This is simply a helper to query the I2PSocketOptions- Specified by:
- getReadTimeoutin interface- I2PSocket
- Returns:
- milliseconds to wait, or -1 if we will wait indefinitely
 
 - 
setReadTimeoutpublic void setReadTimeout(long ms) Description copied from interface:I2PSocketDefine how long we will wait blocked on a read() operation (-1 will make the socket wait forever). This is simply a helper to adjust the I2PSocketOptions- Specified by:
- setReadTimeoutin interface- I2PSocket
- Parameters:
- ms- timeout in ms
 
 - 
closepublic void close() throws IOException- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 - 
resetpublic void reset() throws IOExceptionJust calls close()- Specified by:
- resetin interface- I2PSocket
- Throws:
- IOException
- Since:
- 0.9.30
 
 - 
setSocketErrorListenerpublic void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr) Deprecated, unimplemented, does nothing- Specified by:
- setSocketErrorListenerin interface- I2PSocket
 
 - 
getPortpublic int getPort() The remote port.
 - 
getLocalPortpublic int getLocalPort() The local port.- Specified by:
- getLocalPortin interface- I2PSocket
- Returns:
- 0 always
 
 
- 
 
-