Top Description Inners Fields Constructors Methods
jdk.internal.net.http.common

public Class SSLFlowDelegate

extends Object
Class Inheritance
Known Direct Subclasses
jdk.internal.net.http.common.SSLTube.SSLTubeFlowDelegate
Imports
jdk.internal.net.http.common.SubscriberWrapper.SchedulingAction, javax.net.ssl.SSLEngine, .SSLEngineResult, .SSLEngineResult.HandshakeStatus, .SSLEngineResult.Status, .SSLException, .SSLHandshakeException, java.io.IOException, java.lang.ref.Reference, .ReferenceQueue, .WeakReference, java.nio.ByteBuffer, java.util.ArrayList, .Collections, .Iterator, .LinkedList, .List, java.util.concurrent.CompletableFuture, .ConcurrentLinkedQueue, .Executor, .Flow, .Flow.Subscriber, java.util.concurrent.atomic.AtomicInteger, java.util.concurrent.locks.ReentrantLock, java.util.function.Consumer, .IntBinaryOperator

Implements SSL using two SubscriberWrappers.

Constructor takes two subscribers - downReader and downWriter. downReader receives the application data (after it has been decrypted by SSLFlowDelegate). downWriter receives the network data (after it has been encrypted by SSLFlowDelegate).

Method upstreamWriter() returns a subscriber which should be subscribed with a publisher which publishes application data that can then be encrypted into network data by this SSLFlowDelegate and handed off to the downWriter.

Method upstreamReader() returns a subscriber which should be subscribed with a publisher which publishes encrypted network data that can then be decrypted into application data by this SSLFlowDelegate and handed off to the downReader.

Errors are reported to the downReader subscriber.

The diagram below illustrates how the Flow.Subscribers are used in this class, and where they come from:

--------->  data flow direction


                 |                                   ^
 upstreamWriter  |                                   | downReader
 obtained from   |                                   | supplied to
upstreamWriter() |                                   | constructor
                 v                                   |
     +-----------------------------------------------------------+
     *                                            decrypts       *
     *                       SSLFlowDelegate                     *
     *        encrypts                                           *
     +-----------------------------------------------------------+
                 |                                   ^
   downWriter    |                                   | upstreamReader
   supplied to   |                                   | obtained from
   constructor   |                                   | upstreamReader()
                 v                                   |


Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
public static class
public static interface
pack-priv class
SSLFlowDelegate.Reader

Processing function for incoming data.

pack-priv class
SSLFlowDelegate.Writer

Processing function for outgoing data.

Field Summary

Modifier and TypeField and Description
pack-priv volatile int
pack-priv final CompletableFuture<String>
pack-priv volatile int
pack-priv volatile boolean
pack-priv final Logger
private static final int
pack-priv final SSLEngine
pack-priv final Executor
private static final IntBinaryOperator
pack-priv final AtomicInteger
private static final int
private static final ByteBuffer
pack-priv final int
private static final boolean
pack-priv final SSLFlowDelegate.Monitorable
private static final String
private static final int
NOT_HANDSHAKING

States for handshake.

private static final ByteBuffer
pack-priv volatile int
pack-priv final SSLFlowDelegate.Reader
private static final int
pack-priv final CompletableFuture<Void>
pack-priv final Consumer<ByteBuffer>
private static final IntBinaryOperator
private static final int
pack-priv static AtomicInteger
private static final ByteBuffer
pack-priv final ConcurrentLinkedQueue<String>
pack-priv final CompletableFuture<Void>
pack-priv boolean
private static final int
pack-priv final String
pack-priv final SSLFlowDelegate.Writer
private static final int
pack-priv final CompletableFuture<Void>

Constructor Summary

AccessConstructor and Description
public
SSLFlowDelegate(SSLEngine engine, Executor exec, Flow.Subscriber<? super List<ByteBuffer>> downReader, Flow.Subscriber<? super List<ByteBuffer>> downWriter)

Creates an SSLFlowDelegate fed from two Flow.Subscribers.

public
SSLFlowDelegate(SSLEngine engine, Executor exec, Consumer<ByteBuffer> recycler, Flow.Subscriber<? super List<ByteBuffer>> downReader, Flow.Subscriber<? super List<ByteBuffer>> downWriter)

Creates an SSLFlowDelegate fed from two Flow.Subscribers.

Method Summary

Modifier and TypeMethod and Description
public CompletableFuture<String>
alpn()

Returns a CompletableFuture<String> which completes after the initial handshake completes, and which contains the negotiated alpn.

protected Throwable
private void
public boolean

Returns:

true, if a close_notify was detected.
closeNotifyReceived
()

Returns true if the SSLFlowDelegate has detected a TLS close_notify from the server.

pack-priv void
connect(Flow.Subscriber<? super List<ByteBuffer>>
The left hand side read sink (typically, the HttpConnection read subscriber).
downReader
,
Flow.Subscriber<? super List<ByteBuffer>>
The right hand side write sink (typically the SocketTube write subscriber).
downWriter
)

Connects the read sink (downReader) to the SSLFlowDelegate Reader, and the write sink (downWriter) to the SSLFlowDelegate Writer.

pack-priv final String
pack-priv SSLFlowDelegate.EngineResult
private boolean
protected SubscriberWrapper.SchedulingAction
private void
pack-priv final ByteBuffer
pack-priv final ByteBuffer
private void
public String
private void
private List<Runnable>
public void
private void
public boolean
private void
private static String
private Void
pack-priv boolean
public Flow.Subscriber<List<ByteBuffer>>
upstreamReader()

Returns the upstream Flow.Subscriber of the reading (incoming) side.

public Flow.Subscriber<List<ByteBuffer>>
upstreamWriter()

Returns the upstream Flow.Subscriber of the writing (outgoing) side.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait