|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.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 brosers 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. |
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 |
| 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 SocketChannelpublic boolean isConnected()
isConnected in class SocketChannelpublic boolean isConnectionPending()
isConnectionPending in class SocketChannel
public boolean connect(SocketAddress remote)
throws IOException
connect in class SocketChannelIOException
public boolean finishConnect()
throws IOException
finishConnect in class SocketChannelIOException
public int read(ByteBuffer dst)
throws IOException
read in interface ReadableByteChannelread in class SocketChannelIOException
public long read(ByteBuffer[] dsts,
int offset,
int length)
throws IOException
read in interface ScatteringByteChannelread in class SocketChannelIOException
public int write(ByteBuffer src)
throws IOException
write in interface WritableByteChannelwrite in class SocketChannelIOException
public long write(ByteBuffer[] srcs,
int offset,
int length)
throws IOException
write in interface GatheringByteChannelwrite in class SocketChannelIOExceptionpublic Channel getAdapteeChannel()
AdaptableChannel
getAdapteeChannel in interface AdaptableChannelpublic boolean finished()
SecureChannel
finished in interface SecureChannelpublic int encrypted()
SecureChannel
encrypted in interface SecureChannelpublic int decrypted()
SecureChannel
decrypted in interface SecureChannel
public int handshake(int ops)
throws IOException
SecureChannel
handshake in interface SecureChannelops - the current ready operations set.
IOException - on I/O errors.
public boolean shutdown()
throws IOException
SecureChannel
shutdown in interface SecureChannelIOException - on I/O errors.
public void flush()
throws IOException
SecureChannel
flush in interface SecureChannelIOException - on I/O errors.public String toString()
toString in class Object
protected void implCloseSelectableChannel()
throws IOException
implCloseSelectableChannel in class AbstractSelectableChannelIOException
protected void implConfigureBlocking(boolean block)
throws IOException
implConfigureBlocking in class AbstractSelectableChannelIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||