| | |
| | | @Override |
| | | protected void initChannel(SocketChannel socketChannel) throws Exception { |
| | | // String path = "C:\\Program Files\\Apache Software Foundation\\Tomcat 8.5\\cert\\SHA256withRSA_lzhyc.cn.pfx"; |
| | | String path = "/usr/local/server/app/cert/tomcat/scs1680576839056_chaoshengdaijia.com_server.jks"; |
| | | SSLContext sslContext = createSSLContext.createSSLContext("JKS" |
| | | , path, "Zf3^5v6OoWmOVgeQ"); |
| | | //SSLEngine 此类允许使用ssl安全套接层协议进行安全通信 |
| | | SSLEngine engine = sslContext.createSSLEngine(); |
| | | engine.setUseClientMode(false); |
| | | socketChannel.pipeline().addLast("ssl", new SslHandler(engine)); |
| | | // String path = "/usr/local/server/app/cert/tomcat/scs1680576839056_chaoshengdaijia.com_server.jks"; |
| | | // SSLContext sslContext = createSSLContext.createSSLContext("JKS" |
| | | // , path, "Zf3^5v6OoWmOVgeQ"); |
| | | // //SSLEngine 此类允许使用ssl安全套接层协议进行安全通信 |
| | | // SSLEngine engine = sslContext.createSSLEngine(); |
| | | // engine.setUseClientMode(false); |
| | | // socketChannel.pipeline().addLast("ssl", new SslHandler(engine)); |
| | | |
| | | // 设置30秒没有读到数据,则触发一个READER_IDLE事件。 |
| | | // pipeline.addLast(new IdleStateHandler(30, 0, 0)); |