在netty中添加自带的SslHandler就能支持HTTPS,但是添加之后使用HTTP访问是存在问题的。请问如何能支持使用用一个端口两种协议并行,比如在某个事件中判断出使用HTTPS协议然后在把SslHandler添加到pipeline中。SelfSignedCertificatessc=newSelfSignedCertificate();SslContextsslCtx=SslContextBuilder.forServer(ssc.certificate(),ssc.privateKey()).build();SSLEnginesslEngine=sslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT);ch.pipeline().addFirst(newSslHandler(sslEngine));
高慧超
相关分类