public class SSLEngineFilterLayer extends FilterLayer
FilterLayer that encrypts the communication between the upper layers and the lower layers using
the supplied SSLEngine.| Modifier and Type | Class and Description |
|---|---|
static interface |
SSLEngineFilterLayer.Listener
A listener for the connection headers.
|
ProtocolLayer.Recv, ProtocolLayer.SendEMPTY_BUFFER, UTF_8| Constructor and Description |
|---|
SSLEngineFilterLayer(SSLEngine engine,
SSLEngineFilterLayer.Listener listener)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
doCloseSend()
Notify the lower layer that it should close.
|
void |
doSend(ByteBuffer message)
SPI: Sends data to the lower layer.
|
boolean |
isRecvOpen()
Tracks if this layer is accepting received data via
ProtocolLayer.Recv.onRecv(ByteBuffer). |
boolean |
isSendOpen()
Tracks if this layer is submitting data to be sent via
ProtocolLayer.Send.doSend(ByteBuffer). |
void |
onRecv(ByteBuffer readBuffer)
SPI: Callback on data being received from the lower layer.
|
void |
onRecvClosed(IOException cause)
Callback on the lower layer's source of data being closed.
|
void |
start()
Starts this layer.
|
public SSLEngineFilterLayer(@Nonnull SSLEngine engine, @CheckForNull SSLEngineFilterLayer.Listener listener)
engine - the engine to use.listener - the listener to notify when handshaking is completed.public void start()
throws IOException
start in interface ProtocolLayerstart in class FilterLayerIOException - if something goes wrong.public void onRecv(@Nonnull ByteBuffer readBuffer) throws IOException
onRecv in interface ProtocolLayer.RecvonRecv in class FilterLayerreadBuffer - the data received. Any data consumed from the ByteBuffer can be assumed as processed.
Any data not consumed from the ByteBuffer will be the responsibility of the caller
to resubmit in subsequent calls.IOException - if there was an error during processing of the received data.public void onRecvClosed(IOException cause) throws IOException
onRecvClosed in interface ProtocolLayer.RecvonRecvClosed in class FilterLayercause - the cause of the lower layer being closed or null.IOException - if there was an error during the processing of the close notification.public boolean isRecvOpen()
ProtocolLayer.Recv.onRecv(ByteBuffer).
Once this method returns false it must always return false and can be assumed to behave in
this way.isRecvOpen in interface ProtocolLayer.RecvisRecvOpen in class FilterLayertrue if accepting received data via ProtocolLayer.Recv.onRecv(ByteBuffer).public void doSend(@Nonnull ByteBuffer message) throws IOException
doSend in interface ProtocolLayer.SenddoSend in class FilterLayermessage - the data to send. Any data consumed from the ByteBuffer can be assumed as processed.
Any data not consumed from the ByteBuffer will be the responsibility of the caller
to resubmit in subsequent calls.IOException - if there was an error during processing of the data.public void doCloseSend()
throws IOException
ProtocolLayer.Recv.onRecvClosed(IOException) for any upper layers.doCloseSend in interface ProtocolLayer.SenddoCloseSend in class FilterLayerIOException - if there was an error closing the lower layer.public boolean isSendOpen()
ProtocolLayer.Send.doSend(ByteBuffer).
Once this method returns false it must always return false and can be assumed to behave in
this way.isSendOpen in interface ProtocolLayer.SendisSendOpen in class FilterLayertrue if submitting data to be sent via ProtocolLayer.Send.doSend(ByteBuffer).Copyright © 2004–2020. All rights reserved.