public class JnlpProtocol4Handler extends JnlpProtocolHandler<Jnlp4ConnectionState>
SSLEngine
to perform a TLS upgrade of the plaintext
connection before any connection secrets are exchanged. The subsequent connection is then secured using TLS. The
implementation uses the IOHub
for non-blocking I/O wherever possible which removes the bottleneck of
the selector thread being used for linearization and I/O that creates a throughput limit with NioChannelHub
.Constructor and Description |
---|
JnlpProtocol4Handler(JnlpClientDatabase clientDatabase,
ExecutorService threadPool,
IOHub ioHub,
SSLContext context,
boolean needClientAuth,
boolean preferNio)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Future<Channel> |
connect(Socket socket,
Map<String,String> headers,
List<? extends JnlpConnectionStateListener> listeners)
Handles an outgoing connection to the server on the supplied socket.
|
Jnlp4ConnectionState |
createConnectionState(Socket socket,
List<? extends JnlpConnectionStateListener> listeners)
Creates the
JnlpConnectionState instance for this JnlpProtocolHandler . |
String |
getName()
Get the name of the protocol.
|
Future<Channel> |
handle(Socket socket,
Map<String,String> headers,
List<? extends JnlpConnectionStateListener> listeners)
Handles an incoming client connection on the supplied socket.
|
connect, getClientDatabase, handle, isEnabled, isPreferNio
public JnlpProtocol4Handler(@Nullable JnlpClientDatabase clientDatabase, @NonNull ExecutorService threadPool, @NonNull IOHub ioHub, @NonNull SSLContext context, boolean needClientAuth, boolean preferNio)
clientDatabase
- the client database.threadPool
- the thread pool.ioHub
- the IOHub
.context
- the SSLContext
.needClientAuth
- to force all clients to have a client certificate in order to connect.preferNio
- true
means that the protocol should attempt to use NIO if possible.public String getName()
getName
in class JnlpProtocolHandler<Jnlp4ConnectionState>
@NonNull public Jnlp4ConnectionState createConnectionState(@NonNull Socket socket, @NonNull List<? extends JnlpConnectionStateListener> listeners)
JnlpProtocolHandler
JnlpConnectionState
instance for this JnlpProtocolHandler
.createConnectionState
in class JnlpProtocolHandler<Jnlp4ConnectionState>
socket
- the Socket
listeners
- the initial JnlpConnectionStateListener
instances.JnlpConnectionState
for this connection.@NonNull public Future<Channel> handle(@NonNull Socket socket, @NonNull Map<String,String> headers, @NonNull List<? extends JnlpConnectionStateListener> listeners) throws IOException
handle
in class JnlpProtocolHandler<Jnlp4ConnectionState>
socket
- the socket.headers
- the headers to send to the client.listeners
- the listeners to process the connection.Future
for the Channel
to the server.IOException
- if the protocol cannot be initiated.@NonNull public Future<Channel> connect(@NonNull Socket socket, @NonNull Map<String,String> headers, @NonNull List<? extends JnlpConnectionStateListener> listeners) throws IOException
connect
in class JnlpProtocolHandler<Jnlp4ConnectionState>
socket
- the socket.headers
- the headers to send to the server.listeners
- the listeners to process the connection.Future
for the Channel
to the server.IOException
- if the protocol cannot be initiated.Copyright © 2004–2022. All rights reserved.