本文整理汇总了Java中io.netty.handler.ssl.OpenSsl.unavailabilityCause方法的典型用法代码示例。如果您正苦于以下问题:Java OpenSsl.unavailabilityCause方法的具体用法?Java OpenSsl.unavailabilityCause怎么用?Java OpenSsl.unavailabilityCause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.netty.handler.ssl.OpenSsl
的用法示例。
在下文中一共展示了OpenSsl.unavailabilityCause方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isOpenSslAvailable
import io.netty.handler.ssl.OpenSsl; //导入方法依赖的package包/类
public static boolean isOpenSslAvailable() {
if (openSslAvailable != null) {
return openSslAvailable;
}
if (ENABLE_OPENSSL && OpenSsl.isAvailable()) {
OpenSsl.ensureAvailability();
openSslAvailable = true;
} else {
Throwable cause = OpenSsl.unavailabilityCause();
LOG.log(Level.INFO, "Native OpenSSL support is not available on this platform: " + cause);
openSslAvailable = false;
}
return openSslAvailable;
}
示例2: selectApplicationProtocolConfig
import io.netty.handler.ssl.OpenSsl; //导入方法依赖的package包/类
/**
* Attempts to select the best {@link ApplicationProtocolConfig} for the given
* {@link SslProvider}.
*/
private static ApplicationProtocolConfig selectApplicationProtocolConfig(SslProvider provider) {
switch (provider) {
case JDK: {
if (JettyTlsUtil.isJettyAlpnConfigured()) {
return ALPN;
}
if (JettyTlsUtil.isJettyNpnConfigured()) {
return NPN;
}
if (JettyTlsUtil.isJava9AlpnAvailable()) {
return ALPN;
}
// Use the ALPN cause since it is prefered.
throw new IllegalArgumentException(
"ALPN is not configured properly. See https://github.com/grpc/grpc-java/blob/master/SECURITY.md#troubleshooting"
+ " for more information.",
JettyTlsUtil.getJettyAlpnUnavailabilityCause());
}
case OPENSSL: {
if (!OpenSsl.isAvailable()) {
throw new IllegalArgumentException(
"OpenSSL is not installed on the system.", OpenSsl.unavailabilityCause());
}
return OpenSsl.isAlpnSupported() ? NPN_AND_ALPN : NPN;
}
default:
throw new IllegalArgumentException("Unsupported provider: " + provider);
}
}