Jetty WebSockets ssl == null错误

时间:2016-10-28 08:51:54

标签: java android ssl websocket jetty

我需要关闭连接,但我得到了这个

.mdf

这是我的套接字代码:

2016-10-28 10:46:07.624:WARN:oeji.nio:handle failed
java.lang.NullPointerException: ssl == null
    at com.android.org.conscrypt.NativeCrypto.SSL_read_BIO(Native Method)
    at com.android.org.conscrypt.OpenSSLEngineImpl.unwrap(OpenSSLEngineImpl.java:477)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:1014)
    at org.eclipse.jetty.io.nio.SslConnection.unwrap(SslConnection.java:536)
    at org.eclipse.jetty.io.nio.SslConnection.process(SslConnection.java:359)
    at org.eclipse.jetty.io.nio.SslConnection.access$900(SslConnection.java:48)
    at org.eclipse.jetty.io.nio.SslConnection$SslEndPoint.fill(SslConnection.java:678)
    at org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:181)
    at org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)
    at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:196)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:833)

我无法理解该错误的原因是什么以及如何解决?我查看了jetty docs并在这里查看了一些帖子,但没有发现任何关于该特定错误的信息

1 个答案:

答案 0 :(得分:2)

您必须停止WebSocketClient。

试试这个:

public void stop(){
 try {
     webSocketClient.stop();
 } catch (Throwable t) {
     t.printStackTrace();//this not called
 }
}

public void stop(){
 try {
     webSocketClient.stop();
     connection.close();
 } catch (Throwable t) {
     t.printStackTrace();//this not called
 }
}

链接:where I have see it