Package org.mozilla.jss.ssl.javax
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:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.ByteChannel,java.nio.channels.Channel,java.nio.channels.GatheringByteChannel,java.nio.channels.InterruptibleChannel,java.nio.channels.NetworkChannel,java.nio.channels.ReadableByteChannel,java.nio.channels.ScatteringByteChannel,java.nio.channels.WritableByteChannel
public class JSSSocketChannel extends java.nio.channels.SocketChannelSSL-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.
-
-
Constructor Summary
Constructors Constructor Description JSSSocketChannel(JSSSocket sslSocket, java.net.Socket parentSocket, java.nio.channels.ReadableByteChannel readChannel, java.nio.channels.WritableByteChannel writeChannel, JSSEngine engine)JSSSocketChannel(JSSSocket sslSocket, java.nio.channels.SocketChannel parent, java.net.Socket parentSocket, java.nio.channels.ReadableByteChannel readChannel, java.nio.channels.WritableByteChannel writeChannel, JSSEngine engine)JSSSocketChannel(JSSSocket sslSocket, java.nio.channels.SocketChannel parent, JSSEngine engine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JSSSocketChannelbind(java.net.SocketAddress local)booleanconnect(java.net.SocketAddress remote)booleanfinishConnect()java.net.SocketAddressgetLocalAddress()<T> TgetOption(java.net.SocketOption<T> name)java.net.SocketAddressgetRemoteAddress()voidimplCloseSelectableChannel()voidimplConfigureBlocking(boolean block)booleanisConnected()booleanisConnectionPending()intread(java.nio.ByteBuffer dst)longread(java.nio.ByteBuffer[] dsts, int offset, int length)voidsetAutoClose(boolean on)Set whether or not to close the underlying Socket when the SSLSocket or this channel is closed.voidsetConsumedData(java.io.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.<T> JSSSocketChannelsetOption(java.net.SocketOption<T> name, T value)JSSSocketChannelshutdownInput()JSSSocketChannelshutdownOutput()JSSSocketsocket()java.util.Set<java.net.SocketOption<?>>supportedOptions()intwrite(java.nio.ByteBuffer src)longwrite(java.nio.ByteBuffer[] srcs, int offset, int length)-
Methods inherited from class java.nio.channels.spi.AbstractSelectableChannel
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, register
-
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
-
-
-
Constructor Detail
-
JSSSocketChannel
public JSSSocketChannel(JSSSocket sslSocket, java.nio.channels.SocketChannel parent, java.net.Socket parentSocket, java.nio.channels.ReadableByteChannel readChannel, java.nio.channels.WritableByteChannel writeChannel, JSSEngine engine) throws java.io.IOException
- Throws:
java.io.IOException
-
JSSSocketChannel
public JSSSocketChannel(JSSSocket sslSocket, java.nio.channels.SocketChannel parent, JSSEngine engine) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
setConsumedData
public void setConsumedData(java.io.InputStream consumed) throws java.io.IOExceptionGive 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:
java.io.IOException
-
setAutoClose
public void setAutoClose(boolean on)
Set whether or not to close the underlying Socket when the SSLSocket or this channel is closed.
-
finishConnect
public boolean finishConnect() throws java.io.IOException- Specified by:
finishConnectin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
read
public int read(java.nio.ByteBuffer dst) throws java.io.IOException- Specified by:
readin interfacejava.nio.channels.ReadableByteChannel- Specified by:
readin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
read
public long read(java.nio.ByteBuffer[] dsts, int offset, int length) throws java.io.IOException- Specified by:
readin interfacejava.nio.channels.ScatteringByteChannel- Specified by:
readin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
write
public int write(java.nio.ByteBuffer src) throws java.io.IOException- Specified by:
writein interfacejava.nio.channels.WritableByteChannel- Specified by:
writein classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
write
public long write(java.nio.ByteBuffer[] srcs, int offset, int length) throws java.io.IOException- Specified by:
writein interfacejava.nio.channels.GatheringByteChannel- Specified by:
writein classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
implCloseSelectableChannel
public void implCloseSelectableChannel() throws java.io.IOException- Specified by:
implCloseSelectableChannelin classjava.nio.channels.spi.AbstractSelectableChannel- Throws:
java.io.IOException
-
bind
public JSSSocketChannel bind(java.net.SocketAddress local) throws java.io.IOException
- Specified by:
bindin interfacejava.nio.channels.NetworkChannel- Specified by:
bindin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
connect
public boolean connect(java.net.SocketAddress remote) throws java.io.IOException- Specified by:
connectin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
getOption
public <T> T getOption(java.net.SocketOption<T> name) throws java.io.IOException- Throws:
java.io.IOException
-
supportedOptions
public java.util.Set<java.net.SocketOption<?>> supportedOptions()
-
setOption
public <T> JSSSocketChannel setOption(java.net.SocketOption<T> name, T value) throws java.io.IOException
- Specified by:
setOptionin interfacejava.nio.channels.NetworkChannel- Specified by:
setOptionin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
socket
public JSSSocket socket()
- Specified by:
socketin classjava.nio.channels.SocketChannel
-
isConnected
public boolean isConnected()
- Specified by:
isConnectedin classjava.nio.channels.SocketChannel
-
isConnectionPending
public boolean isConnectionPending()
- Specified by:
isConnectionPendingin classjava.nio.channels.SocketChannel
-
getLocalAddress
public java.net.SocketAddress getLocalAddress() throws java.io.IOException- Specified by:
getLocalAddressin interfacejava.nio.channels.NetworkChannel- Specified by:
getLocalAddressin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
getRemoteAddress
public java.net.SocketAddress getRemoteAddress() throws java.io.IOException- Specified by:
getRemoteAddressin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
shutdownInput
public JSSSocketChannel shutdownInput() throws java.io.IOException
- Specified by:
shutdownInputin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
shutdownOutput
public JSSSocketChannel shutdownOutput() throws java.io.IOException
- Specified by:
shutdownOutputin classjava.nio.channels.SocketChannel- Throws:
java.io.IOException
-
implConfigureBlocking
public void implConfigureBlocking(boolean block) throws java.io.IOException- Specified by:
implConfigureBlockingin classjava.nio.channels.spi.AbstractSelectableChannel- Throws:
java.io.IOException
-
-