I'm getting below exception in my Android application sometime in a while, not very frequent one.
11-18 10:24:39.621 D/OkHttp (19124): <-- HTTP FAILED: java.net.ConnectException: Failed to connect to www.test.com/abc.abc.2.4:443
11-18 10:24:39.621 D/MSRetrofitCallBack(19124): https://www.test.com/webservices/response
11-18 10:24:39.622 D/TransactionActivity(19124): postUpdateTxn FailFailed to connect to www.test.com/abc.abc.2.4:443
After started decode it further at server end, I come to know there is problem in three way handshake of TCP/IP protocol. My app sending SYN to server and server responds with SYN-ACK to my app, post that my app failed to send ACK back to server. Not sure what happened at my app end, I could see network connection in phone is good, however, my app not sending ACK to server. This situation is occurred only when mobile data was used, same app is working fine when WiFi is connected.
Kindly share ideas to find out root cause of this problem.
Few details:
OS: Android 7
Library: com.squareup.retrofit2:retrofit:2.3.0
TCP/IP Communication:
Could you please check the above image, highlighted in Green have [ FIN, ACK ] from server to client and client sends [ ACK ] to server. However, client sends [ SYN ] from same port, is this expected behaviour, if not, who is responsible to fix this.
Thank you!
EDIT 1:
I did followed How to close http client connection after getting the response? to close HTTP connection. Now client(Android) is initiating [ FIN, ACK ] first and server responding [ ACK ]. However, client is not sending [ ACK ] for [ FIN, ACK ] coming from server, not sure this would cause any issue, please help.