You should use HttpURLConnection instead of HttpClient on Android.
Conn.connect ()
This sentence does not need to be called explicitly, the following method will be called automatically, but the explicit call will not be pregnant.
Disconnect ()
Idle connections are closed in other JVM implementations. So the call is not normally shown, but the Android implementation is different and needs to be called
Once The response body has been read, the httpurlconnection should is closed by calling disconnect (). Disconnecting releases the resources held by a connection so they could be closed or reused.
The early version of Android has a bug, so the connection pool is disabled in earlier versions.
private void Disableconnectionreuseifnecessary () {
HTTP connection reuse which was buggy Pre-froyo
if (Integer.parseint (Build.VERSION.SDK) < Build.version_codes. FROYO) {
System.setproperty ("Http.keepalive", "false");
}
}
HttpURLConnection on Android