dsrees/JavaPhoenixClient

connection needs to be cleared after an error

dsrees opened this issue · 1 comments

If the socket connection is lost due to a loss in network connectivity, the connection needs to be reset. Example of this is to open a websocket and then switch to Airplane mode on Android. This will trigger an SSLException, killing the connection. However socket.isConnected will still return true until the heartbeat is not responded to.

javax.net.ssl.SSLException: Write error: ssl=0x744bbdcd08: I/O error during system call, Broken pipe
	at com.android.org.conscrypt.NativeCrypto.SSL_write(Native Method)
	at com.android.org.conscrypt.NativeSsl.write(NativeSsl.java:414)
	at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLOutputStream.write(ConscryptFileDescriptorSocket.java:623)
	at okio.Okio$1.write(Okio.java:79)
	at okio.AsyncTimeout$1.write(AsyncTimeout.java:180)
	at okio.RealBufferedSink.flush(RealBufferedSink.java:224)
	at okhttp3.internal.ws.WebSocketWriter.writeControlFrame(WebSocketWriter.java:146)
	at okhttp3.internal.ws.WebSocketWriter.writeClose(WebSocketWriter.java:106)
	at okhttp3.internal.ws.RealWebSocket.writeOneFrame(RealWebSocket.java:507)
	at okhttp3.internal.ws.RealWebSocket$1.run(RealWebSocket.java:159)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:764)

Resolved in 0.1.3