What android Http Client to use for Ice Cream Sand

2019-03-22 15:27发布

问题:

I have an app that needs to support Android 1.6+

Based on this article: http://android-developers.blogspot.com/2011/09/androids-http-clients.html

In my experience this bug: (from link)

Prior to Froyo, HttpURLConnection had some frustrating bugs. In particular, calling close() on a readable InputStream could poison the connection pool. Work around this by disabling connection pooling."

...

For Gingerbread and better, HttpURLConnection is the best choice. Its simple API and small size makes it great fit for Android. Transparent compression and response caching reduce network use, improve speed and save battery. New applications should use HttpURLConnection; it is where we will be spending our energy going forward."

I'm finding that for android sdk version 9-13 HttpUrlConnection is working great with keep alives and gzip. However on ICS the bugs from froyo and previous versions are back. The connection pool gets poisoned and starts throwing exceptions that the connection is already established trying to add request headers etc. This same code works great on sdk 9-13.

I've verified that this is on emulator and devices.

Is anyone else experiencing this same problem?

标签: android http