1

我正在尝试使用 Netty 5.0.0.Alpha2 编写一个 HTTP 客户端来连接到专有服务器。我只能将连接描述为类似于 Websockets 但不是。服务器使用 StartTLS,它预计将在服务器响应 200 和 Content Type 后由客户端初始化,如果您不这样做,服务器会断开您的连接。一旦连接安全,服务器将在响应客户端命令时无限期地保持连接。无论如何,下面是我的 SSLDump 日志,关​​于“未知 SSL 内容类型 1”这一行,一旦我尝试将我的第一个命令发送到服务器,就会发生这种情况。来自服务器的流量似乎不受阻碍,因为服务器每 30-60 秒发送一次 ping 心跳,我可以很好地读取它。

SSLDump 日志:

New TCP connection #1: Chiori-chan.local(54679) <-> ***.***.***.***(443)
0.1110 (0.1110)  C>S
---------------------------------------------------------------
GET /fwd/xControl HTTP/1.0

---------------------------------------------------------------

0.1776 (0.0666)  S>C
---------------------------------------------------------------
HTTP/1.0 200 OK
Content-Type: application/octet-stream
---------------------------------------------------------------

0.2440 (0.0664)  S>C
---------------------------------------------------------------

---------------------------------------------------------------

1 1  0.2582 (0.0142)  C>SV3.1(54)  Handshake
      ClientHello
        Version 3.1 
        random[32]=
          55 0c 50 be 81 96 8d 83 b2 8d 91 fd 02 3d f5 ff 
          1e 9d 65 48 3a 3b 8c a1 63 d4 e1 17 45 24 c8 90 
        cipher suites
        TLS_RSA_WITH_RC4_128_SHA
        TLS_RSA_WITH_RC4_128_MD5
        compression methods
                  NULL
1 2  0.3332 (0.0749)  S>CV3.1(81)  Handshake
      ServerHello
        Version 3.1 
        random[32]=
          fb 50 d9 c3 2d f2 b1 2f 43 ac 69 eb 54 6b 79 1e 
          34 68 0b e8 5b 90 74 d8 0a bd 0e 46 be 9b 80 54 
        session_id[32]=
          cf 67 a2 86 b4 c0 26 08 6a f4 4c 86 16 8a da df 
          34 fc da 75 66 cd 38 a6 c6 42 21 cf 3e a4 c9 73 
        cipherSuite         TLS_RSA_WITH_RC4_128_SHA
        compressionMethod                   NULL
1 3  0.3332 (0.0000)  S>CV3.1(471)  Handshake
      Certificate
        certificate[461]=
          30 82 01 ... omitted ... fa 3f 56 
1 4  0.3332 (0.0000)  S>CV3.1(4)  Handshake
      ServerHelloDone
1 5  0.3490 (0.0157)  C>SV3.1(134)  Handshake
      ClientKeyExchange
        EncryptedPreMasterSecret[128]=
          c5 f6 2e ... omitted ... 4b f2 64 
1 6  0.3490 (0.0000)  C>SV3.1(1)  ChangeCipherSpec
1 7  0.3490 (0.0000)  C>SV3.1(36)  Handshake
1 8  0.4161 (0.0671)  S>CV3.1(1)  ChangeCipherSpec
1 9  0.4161 (0.0000)  S>CV3.1(36)  Handshake
Unknown SSL content type 1
1 10 0.4891 (0.0729)  S>CV3.1(22)  Alert
1 11 0.4892 (0.0001)  S>CV3.1(22)  Alert
1 12 0.4893 (0.0000)  S>CV3.1(22)  Alert
1 13 0.4930 (0.0036)  C>SShort record
1    2.7379 (2.2449)  C>S  TCP FIN
1    2.8043 (0.0663)  S>C  TCP FIN

Java日志:

Mar 20, 2015 11:54:21 AM io.netty.handler.logging.LoggingHandler channelRegistered
INFO: [id: 0x811e4e4d] REGISTERED
Mar 20, 2015 11:54:21 AM io.netty.handler.logging.LoggingHandler connect
INFO: [id: 0x811e4e4d] CONNECT: /omitted:443
Mar 20, 2015 11:54:21 AM io.netty.handler.logging.LoggingHandler channelActive
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] ACTIVE
Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler write
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] WRITE: 40B
GET /fwd/xControl HTTP/1.0
Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler flush
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] FLUSH
Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler channelRead
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] RECEIVED: 57B
HTTP/1.0 200 OK
Content-Type: application/octet-stream
Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler channelRead
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] RECEIVED: 2B
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 0d 0a                                           |..              |
+--------+-------------------------------------------------+----------------+
RCVD: DefaultHttpResponse(decodeResult: success, version: HTTP/1.0)
HTTP/1.0 200 OK
Content-Type: application/octet-stream
Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler userEventTriggered
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] USER_EVENT: io.netty.handler.ssl.SslHandshakeCompletionEvent@1dc9b12c
Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler write
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] WRITE: 66B
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 01 00 1a 00 16 00 00 00 0b 03 06 05 7e 4c 47 49 |............~LGI|
|00000010| 4e 03 00 00 00 00 00 98 9a c0 0b 02 02 02 01 00 |N...............|
|00000020| 20 00 1c 00 00 00 0b 03 06 05 7e 4c 47 49 4e 03 | .........~LGIN.|
|00000030| 00 00 00 00 00 9c 9a c0 0b 02 06 05 61 64 6d 69 |............admi|
|00000040| 6e 02                                           |n.              |
+--------+-------------------------------------------------+----------------+
Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler flush
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] FLUSH
Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler exceptionCaught
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] EXCEPTION: io.netty.handler.codec.DecoderException: javax.net.ssl.SSLException: Received fatal alert: protocol_version
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLException: Received fatal alert: protocol_version
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:347)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:230)
    at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
    at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
    at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:956)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:127)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:514)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:471)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:385)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:351)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
    at io.netty.util.internal.chmv8.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412)
    at io.netty.util.internal.chmv8.ForkJoinTask.doExec(ForkJoinTask.java:280)
    at io.netty.util.internal.chmv8.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:877)
    at io.netty.util.internal.chmv8.ForkJoinPool.scan(ForkJoinPool.java:1706)
    at io.netty.util.internal.chmv8.ForkJoinPool.runWorker(ForkJoinPool.java:1661)
    at io.netty.util.internal.chmv8.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:126)
Caused by: javax.net.ssl.SSLException: Received fatal alert: protocol_version
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1619)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1587)
    at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1756)
    at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1060)
    at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:884)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:758)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1071)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:938)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:891)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:316)
    ... 18 more

Mar 20, 2015 11:54:22 AM io.netty.channel.DefaultChannelPipeline$TailContext exceptionCaught
WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLException: Received fatal alert: protocol_version
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:347)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:230)
    at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
    at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
    at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:956)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:127)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:514)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:471)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:385)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:351)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
    at io.netty.util.internal.chmv8.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412)
    at io.netty.util.internal.chmv8.ForkJoinTask.doExec(ForkJoinTask.java:280)
    at io.netty.util.internal.chmv8.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:877)
    at io.netty.util.internal.chmv8.ForkJoinPool.scan(ForkJoinPool.java:1706)
    at io.netty.util.internal.chmv8.ForkJoinPool.runWorker(ForkJoinPool.java:1661)
    at io.netty.util.internal.chmv8.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:126)
Caused by: javax.net.ssl.SSLException: Received fatal alert: protocol_version
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1619)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1587)
    at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1756)
    at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1060)
    at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:884)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:758)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1071)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:938)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:891)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:316)
    ... 18 more

Mar 20, 2015 11:54:22 AM io.netty.handler.logging.LoggingHandler exceptionCaught
INFO: [id: 0x811e4e4d, /10.0.0.152:54679 => /omitted:443] EXCEPTION: io.netty.handler.codec.DecoderException: javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:347)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:230)
    at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
    at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
    at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:956)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:127)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:514)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:471)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:385)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:351)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
    at io.netty.util.internal.chmv8.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412)
    at io.netty.util.internal.chmv8.ForkJoinTask.doExec(ForkJoinTask.java:280)
    at io.netty.util.internal.chmv8.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:877)
    at io.netty.util.internal.chmv8.ForkJoinPool.scan(ForkJoinPool.java:1706)
    at io.netty.util.internal.chmv8.ForkJoinPool.runWorker(ForkJoinPool.java:1661)
    at io.netty.util.internal.chmv8.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:126)
Caused by: javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1619)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1587)
    at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1756)
    at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1060)
    at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:884)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:758)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1071)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:938)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:891)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:316)
    ... 18 more

Mar 20, 2015 11:54:22 AM io.netty.channel.DefaultChannelPipeline$TailContext exceptionCaught
WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:347)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:230)
    at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
    at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
    at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:956)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:127)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:514)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:471)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:385)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:351)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
    at io.netty.util.internal.chmv8.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412)
    at io.netty.util.internal.chmv8.ForkJoinTask.doExec(ForkJoinTask.java:280)
    at io.netty.util.internal.chmv8.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:877)
    at io.netty.util.internal.chmv8.ForkJoinPool.scan(ForkJoinPool.java:1706)
    at io.netty.util.internal.chmv8.ForkJoinPool.runWorker(ForkJoinPool.java:1661)
    at io.netty.util.internal.chmv8.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:126)
Caused by: javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1619)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1587)
    at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1756)
    at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1060)
    at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:884)
    at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:758)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1071)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:938)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:891)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:316)
    ... 18 more

有人可以向我解释为什么我会收到这个错误以及我能做些什么来纠正它?我一开始以为是我用来写数据的对象类型,即ByteBuf,但我尝试了很多其他对象,似乎都没有效果。我确定有一个明显的原因,我只是没有看到它。我对在 Netty 中使用 SSL 还是很陌生,而且很遗憾我找不到像我认为 Netty 会被广泛使用的那样多的文档。

我将不胜感激人们可以提供的任何帮助。

编辑:

有趣的是,使用我使用相同 SSL 引擎编程的服务器(还有 Netty 和 Java)声称它也可以建立连接,但是它应该在接收我的命令的地方打印这个错误。这会让我相信我的客户端没有正确编码 ssl 数据包,因为它报告的记录是纯文本的。

Mar 20, 2015 3:18:36 PM io.netty.channel.DefaultChannelPipeline$TailHandler exceptionCaught
WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 01000c00080000000b01060470696e67
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:832)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:228)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:141)
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:341)
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:327)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:116)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:494)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:461)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
    at java.lang.Thread.run(Thread.java:745)
4

1 回答 1

1

看来我是个彻头彻尾的白痴。就像我说的,我是使用 SSL 和 Netty 的新手。

结果在我的 SslHandler() 构造函数下的代码中,有一个名为 startTLS 的第二个可选布尔值。如果设置为 True,SslHandler 会将您的第一条消息作为纯文本输出。我被 javadoc 弄糊涂了StartTLS is the communication pattern that secures the wire in the middle of the plaintext connection. Please note that it is different from SSL/TLS, that secures the wire from the beginning of the connection.,因为我是在发送 HTTP 标头后启动 SSL,所以我认为 StartTLS 是我想要的。

同样,我对我找不到的 Netty 文档感到失望。我只是松了一口气,这个愚蠢的问题现在已经解决了,我可以继续对这个网络协议进行逆向工程。

于 2015-03-20T23:35:17.223 回答