private static ApplicationProtocolSelector toApplicationProtocolSelector(
        final BiFunction<SSLSocket, List<String>, String> selector) {
        return selector == null ? null : new ApplicationProtocolSelector() {
            @Override
            public String selectApplicationProtocol(SSLEngine socket, List<String> protocols) {
                throw new UnsupportedOperationException();
            }

            @Override
            public String selectApplicationProtocol(SSLSocket socket, List<String> protocols) {
                return selector.apply(socket, protocols);
            }
        };
    }
A version of ConscryptFileDescriptorSocket that includes the new Java 9 (and potentially later
patches of 8) {@code setHandshakeApplicationProtocolSelector} API (which requires Java 8 for
compilation, due to the use of {@link BiFunction}).
common/src/main/java/org/conscrypt/Java8FileDescriptorSocket.java