gpt4 book ai didi

security - 开箱即用地运行 Netty 3.3.1-Final Secure Chat 示例会出现错误 "Client/Server mode not yet set."

转载 作者:太空宇宙 更新时间:2023-11-03 12:52:54 24 4
gpt4 key购买 nike

我正在开箱即用地运行 Netty 3.3.1 安全聊天示例,但它出错了。似乎是客户端有问题——错误显示为“尚未设置客户端/服务器模式。”

我阅读了 SSLHandler 上的文档,上面写着:“如果 isIssueHandshake 为 false(默认),您将需要自己处理调用握手。在大多数情况下,SslHandler 用于‘客户端模式’,您想​​要发出一个建立连接后握手。如果 setIssueHandshake 设置为 true,则您无需担心,因为 SslHandler 会处理它。”

我尝试在调用 sslHandler.handshake 方法之前在客户端中将 setIssueHandshake 设置为 true,但这并没有改变/修复错误。

有什么猜测吗?

感谢您对这个网络新手的任何帮助!

这是客户端输出:

Mar 2, 2012 10:25:27 AM securechat.SecureChatClientHandler handleUpstream INFO: [id: 0x00c2a132] OPEN Mar 2, 2012 10:25:27 AM securechat.SecureChatClientHandler handleUpstream INFO: [id: 0x00c2a132, /127.0.0.1:3082 => localhost/127.0.0.1:8443] BOUND: /127.0.0.1:3082 Mar 2, 2012 10:25:27 AM securechat.SecureChatClientHandler handleUpstream INFO: [id: 0x00c2a132, /127.0.0.1:3082 => localhost/127.0.0.1:8443] CONNECTED: localhost/127.0.0.1:8443 Mar 2, 2012 10:25:27 AM securechat.SecureChatClientHandler exceptionCaught WARNING: Unexpected exception from downstream. java.lang.IllegalStateException: Client/Server mode not yet set. at com.sun.net.ssl.internal.ssl.SSLEngineImpl.kickstartHandshake(SSLEngineImpl.java:609) at com.sun.net.ssl.internal.ssl.SSLEngineImpl.beginHandshake(SSLEngineImpl.java:667) at org.jboss.netty.handler.ssl.SslHandler.handshake(SslHandler.java:358) at securechat.SecureChatClientHandler.channelConnected(SecureChatClientHandler.java:54) at securechat.SecureChatClientHandler.handleUpstream(SecureChatClientHandler.java:43) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:61) at org.jboss.netty.handler.ssl.SslHandler.channelConnected(SslHandler.java:1202) at org.jboss.netty.channel.Channels.fireChannelConnected(Channels.java:227) at org.jboss.netty.channel.socket.nio.NioWorker$RegisterTask.run(NioWorker.java:786) at org.jboss.netty.channel.socket.nio.NioWorker.processRegisterTaskQueue(NioWorker.java:250) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:192) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)

这是服务器输出:

INFO: [id: 0x01893efe, /127.0.0.1:3082 => /127.0.0.1:8443] OPEN Mar 2, 2012 10:25:27 AM securechat.SecureChatServerHandler handleUpstream INFO: [id: 0x01893efe, /127.0.0.1:3082 => /127.0.0.1:8443] BOUND: /127.0.0.1:8443 Mar 2, 2012 10:25:27 AM securechat.SecureChatServerHandler handleUpstream INFO: [id: 0x01893efe, /127.0.0.1:3082 => /127.0.0.1:8443] CONNECTED: /127.0.0.1:3082

最佳答案

这是示例中的一个已知错误。如果查看 SecureChatClientPipelineFactory.java,您会发现调用 SSLEngine.setUseClientMode(true) 的行被错误地注释掉了。请取消注释,然后它将起作用。此问题已在 3.4.0.Alpha1 中修复。

关于security - 开箱即用地运行 Netty 3.3.1-Final Secure Chat 示例会出现错误 "Client/Server mode not yet set.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9536063/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com