Package org.conscrypt

Class ApplicationProtocolSelector


  • public abstract class ApplicationProtocolSelector
    extends Object
    Server-side selector for the ALPN protocol. This is a backward-compatibility shim for Java 9's new setHandshakeApplicationProtocolSelector API, which takes a BiFunction (available in Java 8+). This interface is provided to support protocol selection in Java < 8.
    • Constructor Detail

      • ApplicationProtocolSelector

        public ApplicationProtocolSelector()
    • Method Detail

      • selectApplicationProtocol

        public abstract String selectApplicationProtocol​(SSLEngine engine,
                                                         List<String> protocols)
        Selects the appropriate ALPN protocol.
        Parameters:
        engine - the server-side engine
        protocols - The list of client-supplied protocols
        Returns:
        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, a "no_application_protocol" alert will be sent to the peer and the connection will be terminated.
      • selectApplicationProtocol

        public abstract String selectApplicationProtocol​(SSLSocket socket,
                                                         List<String> protocols)
        Selects the appropriate ALPN protocol.
        Parameters:
        socket - the server-side socket
        protocols - The list of client-supplied protocols
        Returns:
        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, a "no_application_protocol" alert will be sent to the peer and the connection will be terminated.