title: Android intermittent SSL Socket read timed out
body: <p>I am building an android app that makes calls to an HTTP/REST api. 
  I have self signed a certificate for testing and added it to my phones trust store. </p>
  
  <p>I have run into a very strange issue where I will receive the following exception:</p>
  
  <pre><code>java.net.SocketTimeoutException: Read timed out
  at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
  at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:705)
  ...
  </code></pre>
  
  <p>I am at a total loss as to how or why this is happening.
  Important notes:</p>
  
  <ul>
  <li>This happens randomly, comes back after lots of request but sometimes goes away for a day or two. </li>
  <li>I cannot reliably reproduce the issue. </li>
  <li>I have adjusted the timeout settings with no results. </li>
  <li>The issue outlives the life-cycle of the application. Restarting the app has no effect, although it seems to resolve itself within 5 mins. </li>
  <li>If I am using a cookie store, removing it seems to resolve the issue temporally. If I am not using a cookie store, a new instance of the HttpClient needs to be created (as cookies persist temporally with the instance of the HttpClient)</li>
  <li>It is not a DNS issue as I can resolve the endpoint (as I have another app that uses the same endpoint and the same crt). </li>
  <li>I am using the AsyncHttp library for android, but the issue still happens outside of using that library. </li>
  <li>I have tried another device with another version of android (no luck).</li>
  </ul>
  
  <p>Interesting things I have tried:</p>
  
  <ul>
  <li>I created a new AsyncHttp instance, made a request (without setting the cookiestore) and successfully received a response. Then the app creates another AsyncHttp instance with the cookie store and the issue persists. Even outside the app life-cycle, the first (non cookied) request will work, but the second will not. </li>
  <li>I tired turning off tcp_timestamp (temporally via the file in proc). No change. </li>
  </ul>
  
  <p>If anyone has some idea or experience with a similar issue, please let me know. </p>