当前位置: 首页>>代码示例>>Java>>正文


Java SSLException.printStackTrace方法代码示例

本文整理汇总了Java中javax.net.ssl.SSLException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java SSLException.printStackTrace方法的具体用法?Java SSLException.printStackTrace怎么用?Java SSLException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.net.ssl.SSLException的用法示例。


在下文中一共展示了SSLException.printStackTrace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildSslCtx

import javax.net.ssl.SSLException; //导入方法依赖的package包/类
private SslContext buildSslCtx() {
  SslProvider provider = OpenSsl.isAlpnSupported() ? SslProvider.OPENSSL : SslProvider.JDK;
  try {
    return SslContextBuilder.forClient()
        .sslProvider(provider)
        .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
        .trustManager(InsecureTrustManagerFactory.INSTANCE)
        // TODO(JR): Make a seperate Handler Class for http2 as opposed to autoneg
        //        .applicationProtocolConfig(new ApplicationProtocolConfig(
        //          ApplicationProtocolConfig.Protocol.ALPN,
        //          // NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
        //          ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,
        //          // ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
        //          ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT,
        //          ApplicationProtocolNames.HTTP_2,
        //          ApplicationProtocolNames.HTTP_1_1))
        .build();
  } catch (SSLException e) {
    e.printStackTrace();
  }

  return null;
}
 
开发者ID:Nordstrom,项目名称:xrpc,代码行数:24,代码来源:XrpcClient.java

示例2: shoot

import javax.net.ssl.SSLException; //导入方法依赖的package包/类
public void shoot(ShootComplete shootComplete) {

        Bootstrap b = new Bootstrap();

        SslContext sslContext = null;
        if (ssl) {
            try {
                sslContext = SslContextBuilder.forClient()
                        .trustManager(InsecureTrustManagerFactory.INSTANCE).build();
            } catch (SSLException e) {
                e.printStackTrace();
            }
        }

        b.group(group)
                .channel(NioSocketChannel.class)
                .handler(new HttpClientInitializer(sslContext));

        // Make the connection attempt.
        b.connect(host, port).addListener(
                (ChannelFutureListener) channelFuture -> {
                    sendHttpRequest(channelFuture, shootComplete);
                });
    }
 
开发者ID:Sammers21,项目名称:Ashbringer-load,代码行数:25,代码来源:NettyShooter.java

示例3: verifyHostname

import javax.net.ssl.SSLException; //导入方法依赖的package包/类
/**
 * Verifies that the certificate matches the specified hostname. Uses the
 * {@link DefaultHostnameVerifier} from the Apache HttpClient library to confirm that the hostname
 * matches the certificate.
 *
 * @param hostname
 * @param leafCert
 * @return
 */
private static boolean verifyHostname(String hostname, X509Certificate leafCert) {
  try {
    // Check that the hostname matches the certificate. This method throws an exception if
    // the cert could not be verified.
    HOSTNAME_VERIFIER.verify(hostname, leafCert);
    return true;
  } catch (SSLException e) {
    e.printStackTrace();
  }

  return false;
}
 
开发者ID:google,项目名称:webauthndemo,代码行数:22,代码来源:OfflineVerify.java

示例4: doTestCustomTrustManager

import javax.net.ssl.SSLException; //导入方法依赖的package包/类
private void doTestCustomTrustManager(boolean serverTrustAll)
        throws Exception {

    if (!TesterSupport.RFC_5746_SUPPORTED) {
        // Make sure SSL renegotiation is not disabled in the JVM
        System.setProperty("sun.security.ssl.allowUnsafeRenegotiation",
                "true");
    }

    Tomcat tomcat = getTomcatInstance();

    Assume.assumeTrue("SSL renegotiation has to be supported for this test",
            TesterSupport.isRenegotiationSupported(getTomcatInstance()));

    TesterSupport.configureClientCertContext(tomcat);

    // Override the defaults
    ProtocolHandler handler = tomcat.getConnector().getProtocolHandler();
    if (handler instanceof AbstractHttp11JsseProtocol) {
        ((AbstractHttp11JsseProtocol<?>) handler).setTruststoreFile(null);
    } else {
        // Unexpected
        fail("Unexpected handler type");
    }
    if (serverTrustAll) {
        tomcat.getConnector().setAttribute("trustManagerClassName",
                "org.apache.tomcat.util.net.TesterSupport$TrustAllCerts");
    }

    // Start Tomcat
    tomcat.start();

    TesterSupport.configureClientSsl();

    // Unprotected resource
    ByteChunk res =
            getUrl("https://localhost:" + getPort() + "/unprotected");
    assertEquals("OK", res.toString());

    // Protected resource
    res.recycle();
    int rc = -1;
    try {
        rc = getUrl("https://localhost:" + getPort() + "/protected", res,
            null, null);
    } catch (SocketException se) {
        if (serverTrustAll) {
            fail(se.getMessage());
            se.printStackTrace();
        }
    } catch (SSLException he) {
        if (serverTrustAll) {
            fail(he.getMessage());
            he.printStackTrace();
        }
    }
    if (serverTrustAll) {
        assertEquals(200, rc);
        assertEquals("OK-" + TesterSupport.ROLE, res.toString());
    } else {
        assertTrue(rc != 200);
        assertEquals("", res.toString());
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:65,代码来源:TestCustomSsl.java


注:本文中的javax.net.ssl.SSLException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。