- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, InterruptibleChannel, NetworkChannel
Simple wrapper for a SSLServerSocket. Cannot be used for asynch ops.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SSLServerSocketThe SSL server socket wrapped as a channel.Constructor Summary
ConstructorsConstructorDescriptionCreate a new SSLServerSocketChannel wrapping the given SSL server socket.Method Summary
All MethodsModifier and TypeMethodDescriptionaccept()Accept a new SSL connection and wrap it in an SSLSocketChannel.bind(SocketAddress local, int backlog) Bind is not supported by this wrapper.Get the local socket address of the underlying server socket.<T> TgetOption(SocketOption<T> name) Get the value of a socket option.voidClose the underlying SSL server socket.voidimplConfigureBlocking(boolean block) Configure the blocking mode.setOption(SocketOption<T> name, T value) Set a socket option.socket()Return the underlying SSL server socket.Set<SocketOption<?>> Get the set of supported socket options.Methods inherited from class ServerSocketChannel
bind, open, open, validOpsMethods inherited from class AbstractSelectableChannel
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, registerMethods inherited from class SelectableChannel
registerMethods inherited from class AbstractInterruptibleChannel
begin, close, end, isOpen
Field Details
_socket
The SSL server socket wrapped as a channel.
Constructor Details
SSLServerSocketChannel
Create a new SSLServerSocketChannel wrapping the given SSL server socket.- Parameters:
socket- the SSL server socket to wrap
Method Details
accept
Accept a new SSL connection and wrap it in an SSLSocketChannel.- Specified by:
acceptin classServerSocketChannel- Returns:
- a new SSLSocketChannel for the accepted connection
- Throws:
IOException- if an I/O error occurs
socket
Return the underlying SSL server socket.- Specified by:
socketin classServerSocketChannel- Returns:
- the wrapped SSLServerSocket
bind
Bind is not supported by this wrapper.- Specified by:
bindin classServerSocketChannel- Parameters:
local- the socket address to bind to (ignored)backlog- the backlog length (ignored)- Returns:
- this channel (never returned)
- Throws:
UnsupportedOperationException- always; the wrapper carries an already-bound server socket and cannot bind another local address
setOption
Set a socket option. This is a no-op for this wrapper.- Specified by:
setOptionin interfaceNetworkChannel- Specified by:
setOptionin classServerSocketChannel- Type Parameters:
T- the type of the socket option value- Parameters:
name- the socket option name (ignored)value- the socket option value (ignored)- Returns:
- this channel, so the ignored option still chains
implCloseSelectableChannel
Close the underlying SSL server socket.- Specified by:
implCloseSelectableChannelin classAbstractSelectableChannel- Throws:
IOException- if an I/O error occurs while closing
implConfigureBlocking
Configure the blocking mode. Only blocking mode is supported.- Specified by:
implConfigureBlockingin classAbstractSelectableChannel- Parameters:
block- true for blocking mode (accepted), false throws- Throws:
IOException- if an I/O error occursUnsupportedOperationException- if block is false
getLocalAddress
Get the local socket address of the underlying server socket.- Specified by:
getLocalAddressin interfaceNetworkChannel- Specified by:
getLocalAddressin classServerSocketChannel- Returns:
- the local socket address, or null if not bound
getOption
Get the value of a socket option. Not supported, always returns null.- Type Parameters:
T- the type of the socket option value- Parameters:
name- the socket option name (ignored)- Returns:
- null always
supportedOptions
Get the set of supported socket options. Returns an empty set.- Returns:
- an empty set of supported socket options