다음을 통해 공유


SSLEngine.HandshakeApplicationProtocolSelector Property

Definition

Retrieves the callback function that selects an application protocol value during a SSL/TLS handshake. -or- Registers a callback function that selects an application protocol value for a SSL/TLS handshake.

public virtual Java.Util.Functions.IBiFunction? HandshakeApplicationProtocolSelector { [Android.Runtime.Register("getHandshakeApplicationProtocolSelector", "()Ljava/util/function/BiFunction;", "GetGetHandshakeApplicationProtocolSelectorHandler", ApiSince=29)] get; [Android.Runtime.Register("setHandshakeApplicationProtocolSelector", "(Ljava/util/function/BiFunction;)V", "GetSetHandshakeApplicationProtocolSelector_Ljava_util_function_BiFunction_Handler", ApiSince=29)] set; }
[<get: Android.Runtime.Register("getHandshakeApplicationProtocolSelector", "()Ljava/util/function/BiFunction;", "GetGetHandshakeApplicationProtocolSelectorHandler", ApiSince=29)>]
[<set: Android.Runtime.Register("setHandshakeApplicationProtocolSelector", "(Ljava/util/function/BiFunction;)V", "GetSetHandshakeApplicationProtocolSelector_Ljava_util_function_BiFunction_Handler", ApiSince=29)>]
member this.HandshakeApplicationProtocolSelector : Java.Util.Functions.IBiFunction with get, set

Property Value

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

Attributes

Remarks

Property getter documentation:

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

Added in 9.

Java documentation for javax.net.ssl.SSLEngine.getHandshakeApplicationProtocolSelector().

Property setter documentation:

Registers a callback function that selects an application protocol value for a SSL/TLS handshake. The function overrides any values supplied using SSLParameters#setApplicationProtocols SSLParameters.setApplicationProtocols and it supports the following type parameters: <blockquote> <dl> <dt> SSLEngine<dd> The function's first argument allows the current SSLEngine to be inspected, including the handshake session and configuration settings. <dt> List<String><dd> The function's second argument lists the application protocol names advertised by the TLS peer. <dt> String<dd> 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.) </dl> </blockquote>

For example, the following call registers a callback function that examines the TLS handshake parameters and selects an application protocol name:

{@code
                serverEngine.setHandshakeApplicationProtocolSelector(
                    (serverEngine, clientProtocols) -> {
                        SSLSession session = serverEngine.getHandshakeSession();
                        return chooseApplicationProtocol(
                            serverEngine,
                            clientProtocols,
                            session.getProtocol(),
                            session.getCipherSuite());
                    });
            }

Added in 9.

Java documentation for javax.net.ssl.SSLEngine.setHandshakeApplicationProtocolSelector(java.util.function.BiFunction<javax.net.ssl.SSLEngine, java.util.List<java.lang.String>, java.lang.String>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to