@Test public void testCreateWithCustomOptions() throws Exception { URI BASE_URI = new URI("tcp: URI configuredURI = new URI(BASE_URI.toString() + "?" + "transport.connectTimeout=" + CUSTOM_CONNECT_TIMEOUT + "&" + "transport.sendBufferSize=" + CUSTOM_SEND_BUFFER_SIZE + "&" + "transport.receiveBufferSize=" + CUSTOM_RECEIVE_BUFFER_SIZE + "&" + "transport.trafficClass=" + CUSTOM_TRAFFIC_CLASS + "&" + "transport.tcpNoDelay=" + CUSTOM_TCP_NO_DELAY + "&" + "transport.tcpKeepAlive=" + CUSTOM_TCP_KEEP_ALIVE + "&" + "transport.soLinger=" + CUSTOM_SO_LINGER + "&" + "transport.soTimeout=" + CUSTOM_SO_TIMEOUT + "&" + "transport.localAddress=" + CUSTOM_LOCAL_ADDRESS + "&" + "transport.localPort=" + CUSTOM_LOCAL_PORT + "&" + "transport.verifyHost=" + CUSTOM_VERIFY_HOST + "&" + "transport.storeType=" + CUSTOM_STORE_TYPE + "&" + "transport.trustAll=" + CUSTOM_TRUST_ALL + "&" + "transport.keyAlias=" + CUSTOM_KEY_ALIAS + "&" + "transport.contextProtocol=" + CUSTOM_CONTEXT_PROTOCOL + "&" + "transport.enabledProtocols=" + CUSTOM_ENABLED_PROTOCOLS_STRING + "&" + "transport.disabledProtocols=" + CUSTOM_DISABLED_PROTOCOLS_STRING + "&" + "transport.enabledCipherSuites=" + CUSTOM_ENABLED_CIPHER_SUITES_STRING + "&" + "transport.disabledCipherSuites=" + CUSTOM_DISABLED_CIPHER_SUITES_STRING); NettySslTransportFactory factory = new NettySslTransportFactory(); Transport transport = factory.createTransport(configuredURI); assertNotNull(transport); assertTrue(transport instanceof NettyTcpTransport); assertFalse(transport.isConnected()); assertTrue(transport.isSecure()); TransportOptions options = transport.getTransportOptions(); assertNotNull(options); assertEquals(CUSTOM_CONNECT_TIMEOUT, options.getConnectTimeout()); assertEquals(CUSTOM_SEND_BUFFER_SIZE, options.getSendBufferSize()); assertEquals(CUSTOM_RECEIVE_BUFFER_SIZE, options.getReceiveBufferSize()); assertEquals(CUSTOM_TRAFFIC_CLASS, options.getTrafficClass()); assertEquals(CUSTOM_TCP_NO_DELAY, options.isTcpNoDelay()); assertEquals(CUSTOM_TCP_KEEP_ALIVE, options.isTcpKeepAlive()); assertEquals(CUSTOM_SO_LINGER, options.getSoLinger()); assertEquals(CUSTOM_SO_TIMEOUT, options.getSoTimeout()); assertEquals(CUSTOM_LOCAL_ADDRESS, options.getLocalAddress()); assertEquals(CUSTOM_LOCAL_PORT, options.getLocalPort()); assertTrue(options instanceof TransportOptions); TransportOptions sslOptions = options; List<String> enabledProtocols = Arrays.asList(sslOptions.getEnabledProtocols()); List<String> customProtocols = Arrays.asList(CUSTOM_ENABLED_PROTOCOLS); assertThat(enabledProtocols, containsInAnyOrder(customProtocols.toArray())); List<String> disabledProtocols = Arrays.asList(sslOptions.getDisabledProtocols()); List<String> customDisabledProtocols = Arrays.asList(CUSTOM_DISABLED_PROTOCOLS); assertThat(disabledProtocols, containsInAnyOrder(customDisabledProtocols.toArray())); List<String> enabledCipherSuites = Arrays.asList(sslOptions.getEnabledCipherSuites()); List<String> customChiperSuites = Arrays.asList(CUSTOM_ENABLED_CIPHER_SUITES); assertThat(enabledCipherSuites, containsInAnyOrder(customChiperSuites.toArray())); List<String> disabledCipherSuites = Arrays.asList(sslOptions.getDisabledCipherSuites()); List<String> customDisabledChiperSuites = Arrays.asList(CUSTOM_DISABLED_CIPHER_SUITES); assertThat(disabledCipherSuites, containsInAnyOrder(customDisabledChiperSuites.toArray())); assertEquals(CUSTOM_STORE_TYPE, sslOptions.getKeyStoreType()); assertEquals(CUSTOM_STORE_TYPE, sslOptions.getTrustStoreType()); assertEquals(CUSTOM_VERIFY_HOST, sslOptions.isVerifyHost()); assertEquals(CUSTOM_KEY_ALIAS, sslOptions.getKeyAlias()); assertEquals(CUSTOM_CONTEXT_PROTOCOL, sslOptions.getContextProtocol()); }
@Override public boolean isSecure() { return true; }
NettySslTransportFactory extends NettyTcpTransportFactory { @Override public boolean isSecure() { return true; } }
NettySslTransportFactory extends NettyTcpTransportFactory { @Override public boolean isSecure() { return true; }  }
NettySslTransportFactory extends NettyTcpTransportFactory { @Override public boolean isSecure() { return true; }  @Override String getName(); @Override boolean isSecure(); }
NettySslTransportFactory extends NettyTcpTransportFactory { @Override public boolean isSecure() { return true; }  @Override String getName(); @Override boolean isSecure();  }