### Question:
TransportSupport { public static boolean isOpenSSLPossible(TransportOptions options) { boolean result = false; if (options.isUseOpenSSL()) { if (!OpenSsl.isAvailable()) { LOG.debug("OpenSSL could not be enabled because a suitable implementation could not be found.", OpenSsl.unavailabilityCause()); } else if (options.getSslContextOverride() != null) { LOG.debug("OpenSSL could not be enabled due to user SSLContext being supplied."); } else if (!OpenSsl.supportsKeyManagerFactory()) { LOG.debug("OpenSSL could not be enabled because the version provided does not allow a KeyManagerFactory to be used."); } else if (options.isVerifyHost() && !OpenSsl.supportsHostnameValidation()) { LOG.debug("OpenSSL could not be enabled due to verifyHost being enabled but not supported by the provided OpenSSL version."); } else if (options.getKeyAlias() != null) { LOG.debug("OpenSSL could not be enabled because a keyAlias is set and that feature is not supported for OpenSSL."); } else { LOG.debug("OpenSSL Enabled: Version {} of OpenSSL will be used", OpenSsl.versionString()); result = true; } } return result; }  static boolean isOpenSSLPossible(TransportOptions options); static SslHandler createSslHandler(ByteBufAllocator allocator, URI remote, TransportOptions options); static SSLContext createJdkSslContext(TransportOptions options); static SSLEngine createJdkSslEngine(URI remote, SSLContext context, TransportOptions options); static SslContext createOpenSslContext(TransportOptions options); static SSLEngine createOpenSslEngine(ByteBufAllocator allocator, URI remote, SslContext context, TransportOptions options);  }### Answer:
@Test(timeout = 100000) public void testIsOpenSSLPossible() throws Exception { assumeTrue(OpenSsl.isAvailable()); assumeTrue(OpenSsl.supportsKeyManagerFactory()); TransportOptions options = new TransportOptions(); options.setUseOpenSSL(false); assertFalse(TransportSupport.isOpenSSLPossible(options)); options.setUseOpenSSL(true); assertTrue(TransportSupport.isOpenSSLPossible(options)); }
@Test(timeout = 100000) public void testIsOpenSSLPossibleWhenHostNameVerificationConfigured() throws Exception { assumeTrue(OpenSsl.isAvailable()); 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)); }
@Test(timeout = 100000) public void testIsOpenSSLPossibleWhenKeyAliasIsSpecified() throws Exception { assumeTrue(OpenSsl.isAvailable()); assumeTrue(OpenSsl.supportsKeyManagerFactory()); assumeTrue(OpenSsl.supportsHostnameValidation()); TransportOptions options = new TransportOptions(); options.setUseOpenSSL(true); options.setKeyAlias("alias"); assertFalse(TransportSupport.isOpenSSLPossible(options)); }