File was renamed from ZuulQYTTravel/src/main/java/com/sinata/zuul/util/applets/ChildChannelHandler.java |
| | |
| | | package com.sinata.zuul.util.applets; |
| | | package com.sinata.push.util.applets; |
| | | |
| | | import io.netty.channel.ChannelInitializer; |
| | | import io.netty.channel.socket.SocketChannel; |
| | | import io.netty.handler.codec.http.HttpObjectAggregator; |
| | | import io.netty.handler.codec.http.HttpServerCodec; |
| | | import io.netty.handler.ssl.ClientAuth; |
| | | import io.netty.handler.ssl.SslContext; |
| | | import io.netty.handler.ssl.SslContextBuilder; |
| | | import io.netty.handler.ssl.SslHandler; |
| | | import io.netty.handler.ssl.util.InsecureTrustManagerFactory; |
| | | import io.netty.handler.stream.ChunkedWriteHandler; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.SSLEngine; |
| | | import java.io.File; |
| | | |
| | | public class ChildChannelHandler extends ChannelInitializer<SocketChannel> { |
| | | @Override |
| | | protected void initChannel(SocketChannel socketChannel) throws Exception { |
| | | // String path = "D:\\Program Files\\Apache Software Foundation\\Tomcat 8.5-80\\cert\\6855055_zhentonggongsi.com.pfx"; |
| | | // String path = "/usr/local/server/apache-tomcat-80/conf/cert/6064978_okyueche.com.pfx"; |
| | | // String path = "C:\\app\\cert\\tomcat\\www.gzjwzc.com.pfx"; |
| | | // SSLContext sslContext = createSSLContext.createSSLContext("PKCS12" |
| | | // , path, "jBOjj2fR"); |
| | | // SSLEngine 此类允许使用ssl安全套接层协议进行安全通信 |
| | | // , path, "79uc9bsd"); |
| | | // SSLEngine engine = sslContext.createSSLEngine(); |
| | | // engine.setUseClientMode(false); |
| | | // socketChannel.pipeline().addLast("ssl", new SslHandler(engine)); |
| | | |
| | | |
| | | File path = new File("/root/server/app/cert/qytzt.cn.key"); |
| | | File path1 = new File("/root/server/app/cert/qytzt.cn.pem"); |
| | | SslContext sslContext = SslContextBuilder.forServer(path, path1, null).clientAuth(ClientAuth.NONE).build(); |
| | | |
| | | //SSLEngine 此类允许使用ssl安全套接层协议进行安全通信 |
| | | SSLEngine engine = sslContext.newEngine(socketChannel.alloc()); |
| | | engine.setUseClientMode(false); |
| | | socketChannel.pipeline().addLast("ssl", new SslHandler(engine)); |
| | | |
| | | // 设置30秒没有读到数据,则触发一个READER_IDLE事件。 |
| | | // pipeline.addLast(new IdleStateHandler(30, 0, 0)); |