Source:
static JdkApplicationProtocolNegotiator toNegotiator(ApplicationProtocolConfig config, boolean isServer) { if (config == null) { return (JdkApplicationProtocolNegotiator) (Object) JdkDefaultApplicationProtocolNegotiatorSubstitution.INSTANCE; } switch (config.protocol()) { case NONE: return (JdkApplicationProtocolNegotiator) (Object) JdkDefaultApplicationProtocolNegotiatorSubstitution.INSTANCE; case ALPN: if (isServer) { ApplicationProtocolConfig.SelectorFailureBehavior behavior = config.selectorFailureBehavior(); if (behavior == ApplicationProtocolConfig.SelectorFailureBehavior.FATAL_ALERT) { return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); } else if (behavior == ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE) { return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); } else { throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectorFailureBehavior()).append(" failure behavior").toString()); } } else { switch (config.selectedListenerFailureBehavior()) { case ACCEPT: return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); case FATAL_ALERT: return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectedListenerFailureBehavior()).append(" failure behavior") .toString()); } } default: throw new UnsupportedOperationException( new StringBuilder("JDK provider does not support ").append(config.protocol()).append(" protocol") .toString()); } }

Target:
static JdkApplicationProtocolNegotiator toNegotiator(ApplicationProtocolConfig config, boolean isServer) { if (config == null) { return (JdkApplicationProtocolNegotiator) (Object) JdkDefaultApplicationProtocolNegotiatorSubstitution.INSTANCE; } switch (config.protocol()) { case NONE: return (JdkApplicationProtocolNegotiator) (Object) JdkDefaultApplicationProtocolNegotiatorSubstitution.INSTANCE; case ALPN: if (isServer) { ApplicationProtocolConfig.SelectorFailureBehavior behavior = config.selectorFailureBehavior(); if (behavior == ApplicationProtocolConfig.SelectorFailureBehavior.FATAL_ALERT) { return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); } if (behavior == ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE) { return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); } throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectorFailureBehavior()).append(" failure behavior").toString()); } else { switch (config.selectedListenerFailureBehavior()) { case ACCEPT: return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); case FATAL_ALERT: return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectedListenerFailureBehavior()).append(" failure behavior") .toString()); } } default: throw new UnsupportedOperationException( new StringBuilder("JDK provider does not support ").append(config.protocol()).append(" protocol") .toString()); } }