Top Description Fields Constructors Methods
org.conscrypt

pack-priv final Class Java8FileDescriptorSocket

extends ConscryptFileDescriptorSocket
Class Inheritance
Imports
java.io.IOException, java.net.InetAddress, .Socket, java.util.List, java.util.function.BiFunction, javax.net.ssl.SSLEngine, .SSLSocket

A version of ConscryptFileDescriptorSocket that includes the new Java 9 (and potentially later patches of 8) setHandshakeApplicationProtocolSelector API (which requires Java 8 for compilation, due to the use of BiFunction).

Field Summary

Modifier and TypeField and Description
private BiFunction<SSLSocket, List<String>, String>

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
Java8FileDescriptorSocket(String hostname, int port, SSLParametersImpl sslParameters)

pack-priv
Java8FileDescriptorSocket(InetAddress address, int port, SSLParametersImpl sslParameters)

pack-priv
Java8FileDescriptorSocket(String hostname, int port, InetAddress clientAddress, int clientPort, SSLParametersImpl sslParameters)

pack-priv
Java8FileDescriptorSocket(InetAddress address, int port, InetAddress clientAddress, int clientPort, SSLParametersImpl sslParameters)

pack-priv
Java8FileDescriptorSocket(Socket socket, String hostname, int port, boolean autoClose, SSLParametersImpl sslParameters)

Method Summary

Modifier and TypeMethod and Description
public BiFunction<SSLSocket, List<String>, String>
getHandshakeApplicationProtocolSelector()

Overrides javax.net.ssl.SSLSocket.getHandshakeApplicationProtocolSelector.

Retrieves the callback function that selects an application protocol value during a SSL/TLS/DTLS handshake.
public void
setHandshakeApplicationProtocolSelector(final BiFunction<SSLSocket, List<String>, String>
the callback function, or null to de-register.
selector
)

Overrides javax.net.ssl.SSLSocket.setHandshakeApplicationProtocolSelector.

Registers a callback function that selects an application protocol value for a SSL/TLS/DTLS handshake.
private static ApplicationProtocolSelector
Inherited from org.conscrypt.ConscryptFileDescriptorSocket:
chooseClientAliaschooseClientPSKIdentitychooseServerAliaschooseServerPSKIdentityHintclientCertificateRequestedclientPSKKeyRequestedcloseexportKeyingMaterialfinalizegetActiveSessiongetApplicationProtocolgetApplicationProtocolsgetChannelIdgetEnabledCipherSuitesgetEnabledProtocolsgetEnableSessionCreationgetHandshakeApplicationProtocolgetHandshakeSessiongetInputStreamgetNeedClientAuthgetOutputStreamgetPSKKeygetSessiongetSoWriteTimeoutgetSSLParametersgetSupportedCipherSuitesgetSupportedProtocolsgetTlsUniquegetUseClientModegetWantClientAuthonNewSessionEstablishedonSSLStateChangeselectApplicationProtocolserverCertificateRequestedserverPSKKeyRequestedserverSessionRequestedsetApplicationProtocolssetApplicationProtocolSelectorsetApplicationProtocolSelectorsetChannelIdEnabledsetChannelIdPrivateKeysetEnabledCipherSuitessetEnabledProtocolssetEnableSessionCreationsetHandshakeTimeoutsetHostnamesetNeedClientAuthsetSoWriteTimeoutsetSSLParameterssetUseClientModesetUseSessionTicketssetWantClientAuthstartHandshakeverifyCertificateChain

Field Detail

selectorback to summary
private BiFunction<SSLSocket, List<String>, String> selector

Constructor Detail

Java8FileDescriptorSocketback to summary
pack-priv Java8FileDescriptorSocket(SSLParametersImpl sslParameters) throws IOException
Java8FileDescriptorSocketback to summary
pack-priv Java8FileDescriptorSocket(String hostname, int port, SSLParametersImpl sslParameters) throws IOException
Java8FileDescriptorSocketback to summary
pack-priv Java8FileDescriptorSocket(InetAddress address, int port, SSLParametersImpl sslParameters) throws IOException
Java8FileDescriptorSocketback to summary
pack-priv Java8FileDescriptorSocket(String hostname, int port, InetAddress clientAddress, int clientPort, SSLParametersImpl sslParameters) throws IOException
Java8FileDescriptorSocketback to summary
pack-priv Java8FileDescriptorSocket(InetAddress address, int port, InetAddress clientAddress, int clientPort, SSLParametersImpl sslParameters) throws IOException
Java8FileDescriptorSocketback to summary
pack-priv Java8FileDescriptorSocket(Socket socket, String hostname, int port, boolean autoClose, SSLParametersImpl sslParameters) throws IOException

Method Detail

getHandshakeApplicationProtocolSelectorback to summary
public BiFunction<SSLSocket, List<String>, String> getHandshakeApplicationProtocolSelector()

Overrides javax.net.ssl.SSLSocket.getHandshakeApplicationProtocolSelector.

Doc from javax.net.ssl.SSLSocket.getHandshakeApplicationProtocolSelector.

Retrieves the callback function that selects an application protocol value during a SSL/TLS/DTLS handshake. See setHandshakeApplicationProtocolSelector for the function's type parameters.

Returns:BiFunction<SSLSocket, List<String>, String>

the callback function, or null if none has been set.

Annotations
@SuppressWarnings:MissingOverride
setHandshakeApplicationProtocolSelectorback to summary
public void setHandshakeApplicationProtocolSelector(final BiFunction<SSLSocket, List<String>, String> selector)

Overrides javax.net.ssl.SSLSocket.setHandshakeApplicationProtocolSelector.

Doc from javax.net.ssl.SSLSocket.setHandshakeApplicationProtocolSelector.

Registers a callback function that selects an application protocol value for a SSL/TLS/DTLS handshake. The function overrides any values supplied using SSLParameters.setApplicationProtocols and it supports the following type parameters:

SSLSocket
The function's first argument allows the current SSLSocket to be inspected, including the handshake session and configuration settings.
List<String>
The function's second argument lists the application protocol names advertised by the TLS peer.
String
The function's result is an application protocol name, or null to indicate that none of the advertised names are acceptable. If the return value is an empty String then application protocol indications will not be used. If the return value is null (no value chosen) or is a value that was not advertised by the peer, the underlying protocol will determine what action to take. (For example, ALPN will send a "no_application_protocol" alert and terminate the connection.)
For example, the following call registers a callback function that examines the TLS handshake parameters and selects an application protocol name:
serverSocket.setHandshakeApplicationProtocolSelector(
        (serverSocket, clientProtocols) -> {
            SSLSession session = serverSocket.getHandshakeSession();
            return chooseApplicationProtocol(
                serverSocket,
                clientProtocols,
                session.getProtocol(),
                session.getCipherSuite());
        });
Parameters
selector:BiFunction<SSLSocket, List<String>, String>

the callback function, or null to de-register.

Annotations
@SuppressWarnings:MissingOverride
toApplicationProtocolSelectorback to summary
private static ApplicationProtocolSelector toApplicationProtocolSelector(final BiFunction<SSLSocket, List<String>, String> selector)