Class SSLEngineFilterLayer
java.lang.Object
org.jenkinsci.remoting.protocol.FilterLayer
org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer
- All Implemented Interfaces:
ProtocolLayer
,ProtocolLayer.Recv
,ProtocolLayer.Send
A
FilterLayer
that encrypts the communication between the upper layers and the lower layers using
the supplied SSLEngine
.- Since:
- 3.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A listener for the connection headers.Nested classes/interfaces inherited from interface org.jenkinsci.remoting.protocol.ProtocolLayer
ProtocolLayer.Recv, ProtocolLayer.Send
-
Field Summary
Fields inherited from interface org.jenkinsci.remoting.protocol.ProtocolLayer
EMPTY_BUFFER
-
Constructor Summary
ConstructorDescriptionSSLEngineFilterLayer
(SSLEngine engine, SSLEngineFilterLayer.Listener listener) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Notify the lower layer that it should close.void
doSend
(ByteBuffer message) SPI: Sends data to the lower layer.boolean
Tracks if this layer is accepting received data viaProtocolLayer.Recv.onRecv(ByteBuffer)
.boolean
Tracks if this layer is submitting data to be sent viaProtocolLayer.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.
-
Constructor Details
-
SSLEngineFilterLayer
public SSLEngineFilterLayer(@NonNull SSLEngine engine, @CheckForNull SSLEngineFilterLayer.Listener listener) Constructs a new instance.- Parameters:
engine
- the engine to use.listener
- the listener to notify when handshaking is completed.
-
-
Method Details
-
start
Starts this layer. All layers in the stack will be initialized before a call to this method. All lower layers in the stack will have been started before this layer is started.- Specified by:
start
in interfaceProtocolLayer
- Overrides:
start
in classFilterLayer
- Throws:
IOException
- if something goes wrong.
-
onRecv
SPI: Callback on data being received from the lower layer.- Specified by:
onRecv
in interfaceProtocolLayer.Recv
- Specified by:
onRecv
in classFilterLayer
- Parameters:
readBuffer
- the data received. Any data consumed from theByteBuffer
can be assumed as processed. Any data not consumed from theByteBuffer
will be the responsibility of the caller to resubmit in subsequent calls.- Throws:
IOException
- if there was an error during processing of the received data.
-
onRecvClosed
Callback on the lower layer's source of data being closed.- Specified by:
onRecvClosed
in interfaceProtocolLayer.Recv
- Overrides:
onRecvClosed
in classFilterLayer
- Parameters:
cause
- the cause of the lower layer being closed ornull
.- Throws:
IOException
- if there was an error during the processing of the close notification.
-
isRecvOpen
public boolean isRecvOpen()Tracks if this layer is accepting received data viaProtocolLayer.Recv.onRecv(ByteBuffer)
. Once this method returnsfalse
it must always returnfalse
and can be assumed to behave in this way.- Specified by:
isRecvOpen
in interfaceProtocolLayer.Recv
- Overrides:
isRecvOpen
in classFilterLayer
- Returns:
true
if accepting received data viaProtocolLayer.Recv.onRecv(ByteBuffer)
.
-
doSend
SPI: Sends data to the lower layer.- Specified by:
doSend
in interfaceProtocolLayer.Send
- Specified by:
doSend
in classFilterLayer
- Parameters:
message
- the data to send. Any data consumed from theByteBuffer
can be assumed as processed. Any data not consumed from theByteBuffer
will be the responsibility of the caller to resubmit in subsequent calls.- Throws:
IOException
- if there was an error during processing of the data.
-
doCloseSend
Notify the lower layer that it should close. Callers to this method are assumed to have already calledProtocolLayer.Recv.onRecvClosed(IOException)
for any upper layers.- Specified by:
doCloseSend
in interfaceProtocolLayer.Send
- Overrides:
doCloseSend
in classFilterLayer
- Throws:
IOException
- if there was an error closing the lower layer.
-
isSendOpen
public boolean isSendOpen()Tracks if this layer is submitting data to be sent viaProtocolLayer.Send.doSend(ByteBuffer)
. Once this method returnsfalse
it must always returnfalse
and can be assumed to behave in this way.- Specified by:
isSendOpen
in interfaceProtocolLayer.Send
- Overrides:
isSendOpen
in classFilterLayer
- Returns:
true
if submitting data to be sent viaProtocolLayer.Send.doSend(ByteBuffer)
.
-