@Override public void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { try { // Enable SNI and session tickets. if (hostname != null) { setUseSessionTickets.invoke(sslSocket, true); // This is SSLParameters.setServerNames() in API 24+. setHostname.invoke(sslSocket, hostname); } // Enable ALPN. setAlpnProtocols.invoke(sslSocket, concatLengthPrefixed(protocols)); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
@Override public void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { if (!sslSocketClass.isInstance(sslSocket)) { return; // No TLS extensions if the socket class is custom. } try { // Enable SNI and session tickets. if (hostname != null) { setUseSessionTickets.invoke(sslSocket, true); // This is SSLParameters.setServerNames() in API 24+. setHostname.invoke(sslSocket, hostname); } // Enable ALPN. setAlpnProtocols.invoke(sslSocket, concatLengthPrefixed(protocols)); } catch (IllegalAccessException | InvocationTargetException e) { throw new AssertionError(e); } }
@Override public void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { // Enable SNI and session tickets. if (hostname != null) { setUseSessionTickets.invokeOptionalWithoutCheckedException(sslSocket, true); setHostname.invokeOptionalWithoutCheckedException(sslSocket, hostname); } // Enable ALPN. if (setAlpnProtocols != null && setAlpnProtocols.isSupported(sslSocket)) { Object[] parameters = {concatLengthPrefixed(protocols)}; setAlpnProtocols.invokeWithoutCheckedException(sslSocket, parameters); } }
@Override public void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { // Enable SNI and session tickets. if (hostname != null) { setUseSessionTickets.invokeOptionalWithoutCheckedException(sslSocket, true); setHostname.invokeOptionalWithoutCheckedException(sslSocket, hostname); } // Enable ALPN. if (setAlpnProtocols != null && setAlpnProtocols.isSupported(sslSocket)) { Object[] parameters = {concatLengthPrefixed(protocols)}; setAlpnProtocols.invokeWithoutCheckedException(sslSocket, parameters); } }