|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.nio.channels.spi.AbstractInterruptibleChannel java.nio.channels.SelectableChannel java.nio.channels.spi.AbstractSelectableChannel java.nio.channels.SocketChannel org.norther.tammi.acorn.nio.SSLSocketChannel
public class SSLSocketChannel
A secure socket channel implementation adding SSL engine based cryprography
to an adapted non-secure concrete SocketChannel
implementation.
This implementation extends abstract SocketChannel
and forwards
applicable calls to methods of the adapted concrete implementation. It also
implements AdaptableChannel
as selectors typically don't accept
channel implementations from other vendors, so the selector registration must
be done with the adaptee channel.
The additional SecureChannel
methods help handshake and shutdown
even though they can also be handled by the read, write and close methods.
Note that the handshake method performs only one such channel read or write
operation during each call that is enabled by the ready set parameter. Any
other way of action seems to cause browsers to block occasionally.
Constructor Summary | |
---|---|
SSLSocketChannel(SocketChannel channel,
SSLEngine engine)
Construct a new channel. |
Method Summary | |
---|---|
boolean |
connect(SocketAddress remote)
|
int |
decrypted()
Returns the number of decrypted bytes not yet read. |
int |
encrypted()
Returns the number of encrypted bytes not yet flushed. |
boolean |
finishConnect()
|
boolean |
finished()
Returns true if this channel is finished with handshaking. |
void |
flush()
Flushes remaining encrypted bytes if any. |
Channel |
getAdapteeChannel()
Gets the adaptee of this adaptable channel. |
SSLSession |
getSession()
Gets the SSL session. |
int |
handshake(int ops)
Starts or continues handshaking with the specified operations. |
protected void |
implCloseSelectableChannel()
|
protected void |
implConfigureBlocking(boolean block)
|
boolean |
isConnected()
|
boolean |
isConnectionPending()
|
int |
read(ByteBuffer dst)
|
long |
read(ByteBuffer[] dsts,
int offset,
int length)
|
boolean |
shutdown()
Starts the shutdown sequence but does not close the channel. |
Socket |
socket()
|
String |
toString()
|
int |
write(ByteBuffer src)
|
long |
write(ByteBuffer[] srcs,
int offset,
int length)
|
Methods inherited from class java.nio.channels.SocketChannel |
---|
open, open, read, validOps, write |
Methods inherited from class java.nio.channels.spi.AbstractSelectableChannel |
---|
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, register |
Methods inherited from class java.nio.channels.SelectableChannel |
---|
register |
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel |
---|
begin, close, end, isOpen |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.nio.channels.Channel |
---|
close, isOpen |
Constructor Detail |
---|
public SSLSocketChannel(SocketChannel channel, SSLEngine engine)
channel
- the unsecure socket channel.engine
- the SSL engine.Method Detail |
---|
public Socket socket()
socket
in class SocketChannel
public boolean isConnected()
isConnected
in class SocketChannel
public boolean isConnectionPending()
isConnectionPending
in class SocketChannel
public boolean connect(SocketAddress remote) throws IOException
connect
in class SocketChannel
IOException
public boolean finishConnect() throws IOException
finishConnect
in class SocketChannel
IOException
public int read(ByteBuffer dst) throws IOException
read
in interface ReadableByteChannel
read
in class SocketChannel
IOException
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
read
in interface ScatteringByteChannel
read
in class SocketChannel
IOException
public int write(ByteBuffer src) throws IOException
write
in interface WritableByteChannel
write
in class SocketChannel
IOException
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
write
in interface GatheringByteChannel
write
in class SocketChannel
IOException
public Channel getAdapteeChannel()
AdaptableChannel
getAdapteeChannel
in interface AdaptableChannel
public boolean finished()
SecureChannel
finished
in interface SecureChannel
public int encrypted()
SecureChannel
encrypted
in interface SecureChannel
public int decrypted()
SecureChannel
decrypted
in interface SecureChannel
public int handshake(int ops) throws IOException
SecureChannel
handshake
in interface SecureChannel
ops
- the current ready operations set.
IOException
- on I/O errors.public boolean shutdown() throws IOException
SecureChannel
shutdown
in interface SecureChannel
IOException
- on I/O errors.public void flush() throws IOException
SecureChannel
flush
in interface SecureChannel
IOException
- on I/O errors.public String toString()
toString
in class Object
public SSLSession getSession()
protected void implCloseSelectableChannel() throws IOException
implCloseSelectableChannel
in class AbstractSelectableChannel
IOException
protected void implConfigureBlocking(boolean block) throws IOException
implConfigureBlocking
in class AbstractSelectableChannel
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |