我试图在Gottox SocketIO的帮助下从Android应用程序连接到Socket IO。 它在Android版本下工作正常,但是在V4.4.2上总是让我得到一个NullPointerException!
建立连接如下:
SSLContext ssl_context = null;
try {
ssl_context = SSLContext.getInstance("TLS", "HarmonyJSSE");
} catch (NoSuchAlgorithmException | KeyManagementException | NoSuchProviderException e) { //
Log.e(LOGIDENT,e.getMessage());
}
_socket = new SocketIO("SOCKETURI");
_socket.connect(new IOCallback() { ... });
这是StackTrace:
12-12 15:41:13.355 21152-21308/com.mynamespace W/System.err﹕ java.lang.NullPointerException
12-12 15:41:13.375 21152-21308/com.mynamespace W/System.err﹕ at com.android.org.conscrypt.SSLSocketWrapper.initTransportLayer(SSLSocketWrapper.java:48)
12-12 15:41:13.380 21152-21308/com.mynamespace W/System.err﹕ at com.android.org.conscrypt.SSLSocketImpl.init(SSLSocketImpl.java:186)
12-12 15:41:13.380 21152-21308/com.mynamespace W/System.err﹕ at com.android.org.conscrypt.SSLSocketImpl.<init>(SSLSocketImpl.java:111)
12-12 15:41:13.385 21152-21308/com.mynamespace W/System.err﹕ at com.android.org.conscrypt.SSLSocketWrapper.<init>(SSLSocketWrapper.java:37)
12-12 15:41:13.390 21152-21308/com.mynamespace W/System.err﹕ at com.android.org.conscrypt.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:91)
12-12 15:41:13.400 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.Connection.upgradeToTls(Connection.java:999)
12-12 15:41:13.405 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.Connection.connect(Connection.java:955)
12-12 15:41:13.415 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:411)
12-12 15:41:13.430 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:343)
12-12 15:41:13.440 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:289)
12-12 15:41:13.440 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
12-12 15:41:13.440 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
12-12 15:41:13.445 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:179)
12-12 15:41:13.450 21152-21308/com.mynamespace W/System.err﹕ at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:246)
12-12 15:41:13.455 21152-21308/com.mynamespace W/System.err﹕ at io.socket.IOConnection.handshake(IOConnection.java:317)
12-12 15:41:13.460 21152-21308/com.mynamespace W/System.err﹕ at io.socket.IOConnection.access$600(IOConnection.java:43)
12-12 15:41:13.460 21152-21308/com.mynamespace W/System.err﹕ at io.socket.IOConnection$ConnectThread.run(IOConnection.java:203)
有人知道这个问题还是类似问题?或者是否有可能进入com.android.okhttp.Connection.upgradeToTls,因为我无法在任何可在线获取的来源中找到第999行。