@Test public void testHttp2SSLFactory() throws Exception { File trustStoreFile = File.createTempFile("truststore", ".jks"); SSLConfig serverSslConfig = new SSLConfig(TestSSLUtils.createHttp2Props("DC1,DC2,DC3", SSLFactory.Mode.SERVER, trustStoreFile, "server")); NettySslHttp2Factory sslFactory = Utils.getObj(NettySslHttp2Factory.class.getName(), serverSslConfig); SSLEngine ssLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.SERVER); SSLConfig clientSSLConfig = new SSLConfig(TestSSLUtils.createHttp2Props("DC1,DC2,DC3", SSLFactory.Mode.CLIENT, trustStoreFile, "client")); sslFactory = Utils.getObj(NettySslHttp2Factory.class.getName(), clientSSLConfig); ssLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.CLIENT); }
@Override public SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode) { SslContext context = mode == Mode.CLIENT ? nettyClientSslContext : nettyServerSslContext; SSLEngine sslEngine = context.newEngine(ByteBufAllocator.DEFAULT, peerHost, peerPort); if (mode == Mode.CLIENT) { SSLParameters sslParams = sslEngine.getSSLParameters(); sslParams.setEndpointIdentificationAlgorithm(endpointIdentification); sslEngine.setSSLParameters(sslParams); } return sslEngine; }
NettySslHttp2Factory implements SSLFactory { @Override public SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode) { SslContext context = mode == Mode.CLIENT ? nettyClientSslContext : nettyServerSslContext; SSLEngine sslEngine = context.newEngine(ByteBufAllocator.DEFAULT, peerHost, peerPort); if (mode == Mode.CLIENT) { SSLParameters sslParams = sslEngine.getSSLParameters(); sslParams.setEndpointIdentificationAlgorithm(endpointIdentification); sslEngine.setSSLParameters(sslParams); } return sslEngine; } }
NettySslHttp2Factory implements SSLFactory { @Override public SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode) { SslContext context = mode == Mode.CLIENT ? nettyClientSslContext : nettyServerSslContext; SSLEngine sslEngine = context.newEngine(ByteBufAllocator.DEFAULT, peerHost, peerPort); if (mode == Mode.CLIENT) { SSLParameters sslParams = sslEngine.getSSLParameters(); sslParams.setEndpointIdentificationAlgorithm(endpointIdentification); sslEngine.setSSLParameters(sslParams); } return sslEngine; } NettySslHttp2Factory(SSLConfig sslConfig); }
NettySslHttp2Factory implements SSLFactory { @Override public SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode) { SslContext context = mode == Mode.CLIENT ? nettyClientSslContext : nettyServerSslContext; SSLEngine sslEngine = context.newEngine(ByteBufAllocator.DEFAULT, peerHost, peerPort); if (mode == Mode.CLIENT) { SSLParameters sslParams = sslEngine.getSSLParameters(); sslParams.setEndpointIdentificationAlgorithm(endpointIdentification); sslEngine.setSSLParameters(sslParams); } return sslEngine; } NettySslHttp2Factory(SSLConfig sslConfig); @Override SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode); @Override SSLContext getSSLContext(); static SslContext getClientSslContext(SSLConfig config); }
NettySslHttp2Factory implements SSLFactory { @Override public SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode) { SslContext context = mode == Mode.CLIENT ? nettyClientSslContext : nettyServerSslContext; SSLEngine sslEngine = context.newEngine(ByteBufAllocator.DEFAULT, peerHost, peerPort); if (mode == Mode.CLIENT) { SSLParameters sslParams = sslEngine.getSSLParameters(); sslParams.setEndpointIdentificationAlgorithm(endpointIdentification); sslEngine.setSSLParameters(sslParams); } return sslEngine; } NettySslHttp2Factory(SSLConfig sslConfig); @Override SSLEngine createSSLEngine(String peerHost, int peerPort, Mode mode); @Override SSLContext getSSLContext(); static SslContext getClientSslContext(SSLConfig config);  }