Interface Connection
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
SocketConnection
public interface Connection extends java.io.Closeable
TheConnection
object is used to manage connections from a server socket. In order to achieve this it spawns a task to listen for incoming connect requests. When a TCP connection request arrives it hands off theSocketChannel
to theSocketProcessor
which processes the request.This handles connections from a
ServerSocketChannel
object so that features such as SSL can be used by a server that uses this package. The background acceptor process will terminate if the connection is closed.- See Also:
SocketProcessor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.net.SocketAddress
connect(java.net.SocketAddress address)
This creates a new background task that will listen to the specifiedServerAddress
for incoming TCP connect requests.java.net.SocketAddress
connect(java.net.SocketAddress address, javax.net.ssl.SSLContext context)
This creates a new background task that will listen to the specifiedServerAddress
for incoming TCP connect requests.
-
-
-
Method Detail
-
connect
java.net.SocketAddress connect(java.net.SocketAddress address) throws java.io.IOException
This creates a new background task that will listen to the specifiedServerAddress
for incoming TCP connect requests. When an connection is accepted it is handed to the internalServer
implementation as a pipeline. The background task is a non daemon task to ensure the server is kept active, to terminate the connection this can be closed.- Parameters:
address
- this is the address used to accept connections- Returns:
- this returns the actual local address that is used
- Throws:
java.io.IOException
-
connect
java.net.SocketAddress connect(java.net.SocketAddress address, javax.net.ssl.SSLContext context) throws java.io.IOException
This creates a new background task that will listen to the specifiedServerAddress
for incoming TCP connect requests. When an connection is accepted it is handed to the internalServer
implementation as a pipeline. The background task is a non daemon task to ensure the server is kept active, to terminate the connection this can be closed.- Parameters:
address
- this is the address used to accept connectionscontext
- this is used for secure SSL connections- Returns:
- this returns the actual local address that is used
- Throws:
java.io.IOException
-
-