Class JSSSocketChannel
java.lang.Object
java.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.SelectableChannel
java.nio.channels.spi.AbstractSelectableChannel
java.nio.channels.SocketChannel
org.mozilla.jss.ssl.javax.JSSSocketChannel
- All Implemented Interfaces:
Closeable, AutoCloseable, ByteChannel, Channel, GatheringByteChannel, InterruptibleChannel, NetworkChannel, ReadableByteChannel, ScatteringByteChannel, WritableByteChannel
SSL-enabled SocketChannel following the javax.net.ssl.SSLSocket interface.
This class should never be constructed directly and instead only accessed
once a Socket is wrapped in a JSSSocket.
This class contains all low-level interactions with the underlying
SSLEngine and reading/writing to/from the underlying Socket.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate InputStreamprivate ReadableByteChannelprivate ByteBufferprivate JSSEngineprivate booleanprivate booleanprivate booleanprivate SocketChannelprivate Socketprivate ByteBufferprivate ReadableByteChannelprivate JSSSocketprivate ByteBufferprivate WritableByteChannel -
Constructor Summary
ConstructorsConstructorDescriptionJSSSocketChannel(JSSSocket sslSocket, Socket parentSocket, ReadableByteChannel readChannel, WritableByteChannel writeChannel, JSSEngine engine) JSSSocketChannel(JSSSocket sslSocket, SocketChannel parent, Socket parentSocket, ReadableByteChannel readChannel, WritableByteChannel writeChannel, JSSEngine engine) JSSSocketChannel(JSSSocket sslSocket, SocketChannel parent, JSSEngine engine) -
Method Summary
Modifier and TypeMethodDescriptionbind(SocketAddress local) private static longcomputeSize(ByteBuffer[] buffers, int offset, int length) Compute the total size of a list of buffers from the specified offest and length.booleanconnect(SocketAddress remote) booleanCollection<? extends EventListener> Gets the current list of event listeners this SSLSocket will fire on certain events.<T> TgetOption(SocketOption<T> name) voidvoidimplConfigureBlocking(boolean block) booleanbooleanintread(ByteBuffer dst) longread(ByteBuffer[] dsts, int offset, int length) private intvoidsetAutoClose(boolean on) Set whether or not to close the underlying Socket when the SSLSocket or this channel is closed.voidsetConsumedData(InputStream consumed) Give data already consumed by a call to the underlying socket's read method to this Socket, allowing it to be read by the SSLEngine.voidsetListeners(Collection<? extends EventListener> listeners) Set the listeners this SSLSocket will fire on certain events.<T> JSSSocketChannelsetOption(SocketOption<T> name, T value) socket()Set<SocketOption<?>> intwrite(ByteBuffer src) longwrite(ByteBuffer[] srcs, int offset, int length) Methods 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
-
sslSocket
-
parent
-
parentSocket
-
readChannel
-
writeChannel
-
engine
-
consumed
-
consumedChannel
-
autoClose
private boolean autoClose -
inboundClosed
private boolean inboundClosed -
outboundClosed
private boolean outboundClosed -
empty
-
readBuffer
-
writeBuffer
-
handshakeCompleted
private boolean handshakeCompleted
-
-
Constructor Details
-
JSSSocketChannel
public JSSSocketChannel(JSSSocket sslSocket, SocketChannel parent, Socket parentSocket, ReadableByteChannel readChannel, WritableByteChannel writeChannel, JSSEngine engine) throws IOException - Throws:
IOException
-
JSSSocketChannel
public JSSSocketChannel(JSSSocket sslSocket, SocketChannel parent, JSSEngine engine) throws IOException - Throws:
IOException
-
JSSSocketChannel
public JSSSocketChannel(JSSSocket sslSocket, Socket parentSocket, ReadableByteChannel readChannel, WritableByteChannel writeChannel, JSSEngine engine) throws IOException - Throws:
IOException
-
-
Method Details
-
setConsumedData
Give data already consumed by a call to the underlying socket's read method to this Socket, allowing it to be read by the SSLEngine.- Throws:
IOException
-
setAutoClose
public void setAutoClose(boolean on) Set whether or not to close the underlying Socket when the SSLSocket or this channel is closed. -
remoteRead
- Throws:
IOException
-
finishConnect
- Specified by:
finishConnectin classSocketChannel- Throws:
IOException
-
computeSize
Compute the total size of a list of buffers from the specified offest and length.- Throws:
IOException
-
read
- Specified by:
readin interfaceReadableByteChannel- Specified by:
readin classSocketChannel- Throws:
IOException
-
read
- Specified by:
readin interfaceScatteringByteChannel- Specified by:
readin classSocketChannel- Throws:
IOException
-
write
- Specified by:
writein interfaceWritableByteChannel- Specified by:
writein classSocketChannel- Throws:
IOException
-
write
- Specified by:
writein interfaceGatheringByteChannel- Specified by:
writein classSocketChannel- Throws:
IOException
-
implCloseSelectableChannel
- Specified by:
implCloseSelectableChannelin classAbstractSelectableChannel- Throws:
IOException
-
setListeners
Set the listeners this SSLSocket will fire on certain events.- See Also:
-
getListeners
Gets the current list of event listeners this SSLSocket will fire on certain events.- See Also:
-
bind
- Specified by:
bindin interfaceNetworkChannel- Specified by:
bindin classSocketChannel- Throws:
IOException
-
connect
- Specified by:
connectin classSocketChannel- Throws:
IOException
-
getOption
- Throws:
IOException
-
supportedOptions
-
setOption
- Specified by:
setOptionin interfaceNetworkChannel- Specified by:
setOptionin classSocketChannel- Throws:
IOException
-
socket
- Specified by:
socketin classSocketChannel
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin classSocketChannel
-
isConnectionPending
public boolean isConnectionPending()- Specified by:
isConnectionPendingin classSocketChannel
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceNetworkChannel- Specified by:
getLocalAddressin classSocketChannel- Throws:
IOException
-
getRemoteAddress
- Specified by:
getRemoteAddressin classSocketChannel- Throws:
IOException
-
shutdownInput
- Specified by:
shutdownInputin classSocketChannel- Throws:
IOException
-
shutdownOutput
- Specified by:
shutdownOutputin classSocketChannel- Throws:
IOException
-
implConfigureBlocking
- Specified by:
implConfigureBlockingin classAbstractSelectableChannel- Throws:
IOException
-