title: android is http.keepalive false necessary when using okhttp
body: <p>I've recently taken over an Android project. We're looking to try to speed up a sync process we have. This is in the code currently:</p>
  
  <pre><code>System.setProperty("http.keepAlive", "false");
  </code></pre>
  
  <p>I didn't write the code, so I don't really know the reason this code was added, but ive done some googling and it seems necessary to keep connections working:</p>
  
  <p><a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html" rel="nofollow noreferrer">http://android-developers.blogspot.com/2011/09/androids-http-clients.html</a></p>
  
  <p><a href="https://stackoverflow.com/questions/3352424/httpurlconnection-openconnection-fails-second-time">HttpUrlConnection.openConnection fails second time</a></p>
  
  <p>When we set this to true, the sync process speeds up substantially, but I don't want to set it to true and not have a decent idea of the consequences. Does anyone know if it's still necessary to set http.keepAlive to false? If so, for all Android devices? Is there an API level where it doesnt matter anymore?</p>
  
  <p>Digging through the code history, we saw where <a href="http://square.github.io/okhttp/" rel="nofollow noreferrer">http://square.github.io/okhttp/</a> was integrated. Is it still necessary to keep this setting to false when we're using OkHTTP?</p>
  
  <p>Thanks!</p>