Example usage for io.netty.handler.ssl OpenSsl supportsHostnameValidation

List of usage examples for io.netty.handler.ssl OpenSsl supportsHostnameValidation

Introduction

In this page you can find the example usage for io.netty.handler.ssl OpenSsl supportsHostnameValidation.

Prototype

@Deprecated
public static boolean supportsHostnameValidation() 

Source Link

Document

Always returns true if #isAvailable() returns true .

Usage

From source file:org.apache.qpid.jms.transports.TransportSupportTest.java

License:Apache License

@Test
public void testCreateSslEngineWithVerifyHostOpenSSL() throws Exception {
    assumeTrue(OpenSsl.isAvailable());//from www  .ja v  a  2 s  .  c  o m
    assumeTrue(OpenSsl.supportsKeyManagerFactory());
    assumeTrue(OpenSsl.supportsHostnameValidation());

    TransportOptions options = createJksSslOptions();
    options.setVerifyHost(true);

    SslContext context = TransportSupport.createOpenSslContext(options);
    assertNotNull(context);

    SSLEngine engine = TransportSupport.createOpenSslEngine(PooledByteBufAllocator.DEFAULT, null, context,
            options);
    assertNotNull(engine);

    assertEquals("HTTPS", engine.getSSLParameters().getEndpointIdentificationAlgorithm());
}

From source file:org.apache.qpid.jms.transports.TransportSupportTest.java

License:Apache License

@Test
public void testCreateSslEngineWithoutVerifyHostOpenSSL() throws Exception {
    assumeTrue(OpenSsl.isAvailable());//from  ww  w  . j  a va 2  s . com
    assumeTrue(OpenSsl.supportsKeyManagerFactory());
    assumeTrue(OpenSsl.supportsHostnameValidation());

    TransportOptions options = createJksSslOptions();
    options.setVerifyHost(false);

    SslContext context = TransportSupport.createOpenSslContext(options);
    assertNotNull(context);

    SSLEngine engine = TransportSupport.createOpenSslEngine(PooledByteBufAllocator.DEFAULT, null, context,
            options);
    assertNotNull(engine);

    assertNull(engine.getSSLParameters().getEndpointIdentificationAlgorithm());
}

From source file:org.apache.qpid.jms.transports.TransportSupportTest.java

License:Apache License

@Test(timeout = 100000)
public void testIsOpenSSLPossibleWhenHostNameVerificationConfigured() throws Exception {
    assumeTrue(OpenSsl.isAvailable());//from  w  w w.  j av  a 2 s.  c o  m
    assumeTrue(OpenSsl.supportsKeyManagerFactory());
    assumeTrue(OpenSsl.supportsHostnameValidation());

    TransportOptions options = new TransportOptions();
    options.setUseOpenSSL(true);

    options.setVerifyHost(false);
    assertTrue(TransportSupport.isOpenSSLPossible(options));

    options.setVerifyHost(true);
    assertTrue(TransportSupport.isOpenSSLPossible(options));
}

From source file:org.apache.qpid.jms.transports.TransportSupportTest.java

License:Apache License

@Test(timeout = 100000)
public void testIsOpenSSLPossibleWhenKeyAliasIsSpecified() throws Exception {
    assumeTrue(OpenSsl.isAvailable());/*from   w  ww . j  av a  2 s  . c om*/
    assumeTrue(OpenSsl.supportsKeyManagerFactory());
    assumeTrue(OpenSsl.supportsHostnameValidation());

    TransportOptions options = new TransportOptions();
    options.setUseOpenSSL(true);
    options.setKeyAlias("alias");

    assertFalse(TransportSupport.isOpenSSLPossible(options));
}