小编Joh*_*rds的帖子

Jetty WebSocketClientSelectorManager - 连接失败java.io.IOException:无法初始化SSL

我为所有代码道歉,但我很困惑为什么这个相同的代码似乎以前工作但现在不是.

我有一个简单的jetty WebSockets客户端,我在标题中得到错误.有趣的是,我有一个带有javascript的HTML文件来运行相同的SSL服务器,它工作正常.

互联网搜索没有出现太多,因为它与此错误有关.

根据jetty源代码,没有SSL上下文:

        if ("wss".equalsIgnoreCase(scheme))
        {
            // Encrypted "wss://"
            SslContextFactory sslContextFactory = getSslContextFactory();
            if (sslContextFactory != null)
            {
                SSLEngine engine = newSSLEngine(sslContextFactory,channel);
                SslConnection sslConnection = new SslConnection(bufferPool,getExecutor(),endPoint,engine);
                sslConnection.setRenegotiationAllowed(sslContextFactory.isRenegotiationAllowed());
                EndPoint sslEndPoint = sslConnection.getDecryptedEndPoint();

                Connection connection = newUpgradeConnection(channel,sslEndPoint,connectPromise);
                sslEndPoint.setIdleTimeout(connectPromise.getClient().getMaxIdleTimeout());
                sslEndPoint.setConnection(connection);
                return sslConnection;
            }
            else
            {
                throw new IOException("Cannot init SSL");
            }
        }
        else
        {
            // Standard "ws://"
            endPoint.setIdleTimeout(connectPromise.getDriver().getPolicy().getIdleTimeout());
            return newUpgradeConnection(channel,endPoint,connectPromise);
        }
Run Code Online (Sandbox Code Playgroud)

以下是执行运行的回溯:

20:32:15.560 [main] INFO  c.d.e.w.EspClientMain - client connected, waiting for close
20:32:15.626 [WebSocketClient@841038702-14] DEBUG o.e.j.i.SelectorManager - Queued change org.eclipse.jetty.io.SelectorManager$ManagedSelector$Connect@7703d828 …
Run Code Online (Sandbox Code Playgroud)

ssl jetty websocket

4
推荐指数
1
解决办法
2013
查看次数

标签 统计

jetty ×1

ssl ×1

websocket ×1