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.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface net.i2p.client.streaming.I2PSocket

      `I2PSocket.SocketErrorListener`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SocketWrapper(Socket sock)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `SelectableChannel` | `getChannel()` Deprecated.
    `InputStream` | `getInputStream()` Gets the input stream from the underlying socket.
    `int` | `getLocalPort()` The local port.
    `I2PSocketOptions` | `getOptions()`
    `OutputStream` | `getOutputStream()` Gets the output stream from the underlying socket.
    `Destination` | `getPeerDestination()`
    `int` | `getPort()` The remote port.
    `long` | `getReadTimeout()` How long we will wait blocked on a read() operation.
    `Destination` | `getThisDestination()`
    `boolean` | `isClosed()`
    `void` | `reset()` Just calls close()
    `void` | `setOptions(I2PSocketOptions options)` Does nothing
    `void` | `setReadTimeout(long ms)` Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever).
    `void` | `setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)` Deprecated, unimplemented, does nothing

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

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

- - ### Constructor Detail

    - #### SocketWrapper

          public SocketWrapper(Socket sock)

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

    - #### getChannel

          @Deprecated
          public SelectableChannel getChannel()

      Deprecated.
      Description copied from interface: `I2PSocket`
      Unimplemented, unlikely to ever be implemented.
      Specified by:
        `getChannel` in interface `I2PSocket`
      Returns:
        null always

    - #### getInputStream

          public InputStream getInputStream()
                                     throws IOException

      Gets the input stream from the underlying socket.
      Specified by:
        `getInputStream` in interface `I2PSocket`
      Returns:
        the socket's input stream
      Throws:
        `IOException` - if the socket is closed

    - #### getLocalPort

          public int getLocalPort()

      The local port.
      Specified by:
        `getLocalPort` in interface `I2PSocket`
      Returns:
        0 always

    - #### getOptions

          public I2PSocketOptions getOptions()

      Specified by:
        `getOptions` in interface `I2PSocket`
      Returns:
        null always

    - #### getOutputStream

          public OutputStream getOutputStream()
                                       throws IOException

      Gets the output stream from the underlying socket.
      Specified by:
        `getOutputStream` in interface `I2PSocket`
      Returns:
        the socket's output stream
      Throws:
        `IOException` - if the socket is closed

    - #### getPeerDestination

          public Destination getPeerDestination()

      Specified by:
        `getPeerDestination` in interface `I2PSocket`
      Returns:
        the destination of the peer.

    - #### getPort

          public int getPort()

      The remote port.
      Specified by:
        `getPort` in interface `I2PSocket`
      Returns:
        Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)

    - #### getReadTimeout

          public long getReadTimeout()

      Description copied from interface: `I2PSocket`
      How long we will wait blocked on a read() operation. This is simply a helper to query the I2PSocketOptions
      Specified by:
        `getReadTimeout` in interface `I2PSocket`
      Returns:
        milliseconds to wait, or -1 if we will wait indefinitely

    - #### getThisDestination

          public Destination getThisDestination()

      Specified by:
        `getThisDestination` in interface `I2PSocket`
      Returns:
        the Destination of this side of the socket.

    - #### isClosed

          public boolean isClosed()

      Specified by:
        `isClosed` in interface `I2PSocket`

    - #### reset

          public void reset()
                     throws IOException

      Just calls close()
      Specified by:
        `reset` in interface `I2PSocket`
      Throws:
        `IOException`

    - #### setOptions

          public void setOptions(I2PSocketOptions options)

      Does nothing
      Specified by:
        `setOptions` in interface `I2PSocket`
      Parameters:
        `options` - I2PSocketOptions to set

    - #### setReadTimeout

          public void setReadTimeout(long ms)

      Description copied from interface: `I2PSocket`
      Define 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:
        `setReadTimeout` in interface `I2PSocket`
      Parameters:
        `ms` - timeout in ms

    - #### setSocketErrorListener

          public void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)

      Deprecated, unimplemented, does nothing
      Specified by:
        `setSocketErrorListener` in interface `I2PSocket`