# Class AsyncChannelWrapperNonSecure

java.lang.Object
org.apache.tomcat.websocket.AsyncChannelWrapperNonSecure

All Implemented Interfaces:
  `AsyncChannelWrapper`

public class AsyncChannelWrapperNonSecure extends Object implements AsyncChannelWrapper
Generally, just passes calls straight to the wrapped `AsynchronousSocketChannel`. In some cases exceptions may be swallowed to save them being swallowed by the calling code.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AsyncChannelWrapperNonSecure(AsynchronousSocketChannel socketChannel)`
  Constructs a new non-secure wrapper for the given channel.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Closes the underlying channel.
  `SocketAddress`
  `getLocalAddress()`
  Returns the local address to which the channel is bound.
  `Future<Void>`
  `handshake()`
  Performs the SSL/TLS handshake.
  `Future<Integer>`
  `read(ByteBuffer dst)`
  Reads data from the channel into the given buffer.
  `<B, A extends B>
  void`
  `read(ByteBuffer dst, A attachment, CompletionHandler<Integer,B> handler)`
  Reads data from the channel into the given buffer with a completion handler.
  `Future<Integer>`
  `write(ByteBuffer src)`
  Writes data from the given buffer to the channel.
  `<B, A extends B>
  void`
  `write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,B> handler)`
  Writes data from the given buffers to the channel with a completion handler.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### AsyncChannelWrapperNonSecure

    public AsyncChannelWrapperNonSecure(AsynchronousSocketChannel socketChannel)
    Constructs a new non-secure wrapper for the given channel.
    Parameters:
      `socketChannel` - the underlying `AsynchronousSocketChannel`

- ## Method Details

  - ### read

    public Future<Integer> read(ByteBuffer dst)
    Description copied from interface: `AsyncChannelWrapper`
    Reads data from the channel into the given buffer.
    Specified by:
      `read` in interface `AsyncChannelWrapper`
    Parameters:
      `dst` - the buffer into which data is to be read
    Returns:
      a Future holding the number of bytes read

  - ### read

    public <B, A extends B> void read(ByteBuffer dst, A attachment, CompletionHandler<Integer,B> handler)
    Description copied from interface: `AsyncChannelWrapper`
    Reads data from the channel into the given buffer with a completion handler.
    Specified by:
      `read` in interface `AsyncChannelWrapper`
    Type Parameters:
      `B` - the attachment type
      `A` - the attachment subtype
    Parameters:
      `dst` - the buffer into which data is to be read
      `attachment` - the object to attach to the task
      `handler` - the handler to use on completion

  - ### write

    public Future<Integer> write(ByteBuffer src)
    Description copied from interface: `AsyncChannelWrapper`
    Writes data from the given buffer to the channel.
    Specified by:
      `write` in interface `AsyncChannelWrapper`
    Parameters:
      `src` - the buffer from which data is to be written
    Returns:
      a Future holding the number of bytes written

  - ### write

    public <B, A extends B> void write(ByteBuffer[] srcs, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long,B> handler)
    Description copied from interface: `AsyncChannelWrapper`
    Writes data from the given buffers to the channel with a completion handler.
    Specified by:
      `write` in interface `AsyncChannelWrapper`
    Type Parameters:
      `B` - the attachment type
      `A` - the attachment subtype
    Parameters:
      `srcs` - the buffers from which data is to be written
      `offset` - the offset within the buffer array
      `length` - the number of buffers to write
      `timeout` - the maximum time to wait
      `unit` - the time unit of the timeout
      `attachment` - the object to attach to the task
      `handler` - the handler to use on completion

  - ### close

    public void close()
    Description copied from interface: `AsyncChannelWrapper`
    Closes the underlying channel.
    Specified by:
      `close` in interface `AsyncChannelWrapper`

  - ### handshake

    public Future<Void> handshake()
    Description copied from interface: `AsyncChannelWrapper`
    Performs the SSL/TLS handshake.
    Specified by:
      `handshake` in interface `AsyncChannelWrapper`
    Returns:
      a Future that completes when the handshake is finished

  - ### getLocalAddress

    public SocketAddress getLocalAddress() throws IOException
    Description copied from interface: `AsyncChannelWrapper`
    Returns the local address to which the channel is bound.
    Specified by:
      `getLocalAddress` in interface `AsyncChannelWrapper`
    Returns:
      the local socket address, or null if not bound
    Throws:
      `IOException` - if an I/O error occurs