protected GrizzlyAlpnNegotiator registerGrizzlyAlpn ( SSLEngine engine , SSLConnectionLink link ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "registerGrizzlyAlpn entry " + engine ) ; } if ( grizzlyNegotiationSupport != null && grizzlyAlpnClientNegotiator != null && grizzlyAlpnServerNegotiator != null && grizzlyNegotiationSupportObject != null ) { try { GrizzlyAlpnNegotiator negotiator = new GrizzlyAlpnNegotiator ( engine , link ) ; if ( ! engine . getUseClientMode ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "initializeAlpn invoke AlpnServerNegotiator " + engine ) ; } // client mode is disabled; call NegotiationSuppoer.addNegotiator(SSLEngine, (AlpnServerNegotiator) this) Method m = grizzlyNegotiationSupport . getMethod ( "addNegotiator" , SSLEngine . class , grizzlyAlpnServerNegotiator ) ; m . invoke ( grizzlyNegotiationSupportObject , new Object [ ] { engine , java . lang . reflect . Proxy . newProxyInstance ( grizzlyAlpnServerNegotiator . getClassLoader ( ) , new java . lang . Class [ ] { grizzlyAlpnServerNegotiator } , negotiator ) } ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "initializeAlpn invoke AlpnClientNegotiator " + engine ) ; } // client mode is enabled; call NegotiationSuppoer.addNegotiator(SSLEngine, (AlpnClientNegotiator) this) Method m = grizzlyNegotiationSupport . getMethod ( "addNegotiator" , SSLEngine . class , grizzlyAlpnClientNegotiator ) ; m . invoke ( grizzlyNegotiationSupportObject , new Object [ ] { engine , java . lang . reflect . Proxy . newProxyInstance ( grizzlyAlpnClientNegotiator . getClassLoader ( ) , new java . lang . Class [ ] { grizzlyAlpnClientNegotiator } , negotiator ) } ) ; } return negotiator ; } catch ( InvocationTargetException ie ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "registerGrizzlyAlpn exception: " + ie . getTargetException ( ) ) ; } } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "registerGrizzlyAlpn grizzly-npn exception: " + e ) ; } } } return null ; }
Using grizzly - npn set up a new GrizzlyAlpnNegotiator to handle ALPN for a given SSLEngine and link