# Interface Socket

All Known Subinterfaces:
  `Transport`

public interface Socket
This is a `Socket` interface that is used to represent a socket. This has a map that allows attributes to be associated with the client connection. Attributes such as security details or other transport related details can be exposed by placing them in the socket map. The `Processor` can then use these attributes as required.

This provides the connected `SocketChannel` that can be used to read and write data asynchronously. The socket channel must be selectable and in non-blocking mode. If the socket is not in a non-blocking state the connection will not be processed.

Author:
  Niall Gallagher

## Method Summary

Modifier and Type
Method
Description
`Map`
`getAttributes()`
This method is used to get the `Map` of attributes for this socket.
`SocketChannel`
`getChannel()`
This method is used to acquire the `SocketChannel` for the connection.
`SSLEngine`
`getEngine()`
This is used to acquire the SSL engine used for security.

## Method Details

### getEngine

SSLEngine getEngine()
This is used to acquire the SSL engine used for security. If the socket is connected to an SSL transport this returns an SSL engine which can be used to establish the secure connection and send and receive content over that connection. If this is null then the socket represents a normal transport.

Returns:
  the SSL engine used to establish a secure transport

### getChannel

SocketChannel getChannel()
This method is used to acquire the `SocketChannel` for the connection. This allows the server to acquire the input and output streams with which to communicate. It can also be used to configure the connection and perform various network operations that could otherwise not be performed.

Returns:
  this returns the socket used by this socket

### getAttributes

Map getAttributes()
This method is used to get the `Map` of attributes for this socket. The attributes map is used to maintain details about the connection. Information such as security credentials to client details can be placed within the attribute map.

Returns:
  this returns the map of attributes for this socket