I\'m connecting to a web server from my android application via HttpsUrlConnection or HttpUrlConnection depending on settings. For now I didn\'t ha
HTTP response code -1, means that something went wrong with connection or response handling. The HttpURLConnection in often buggy with keeping connections alive.
If you want to turn if off, you have to set the http.keepAlive system property into false.
The way to do this programmatically is putting this at the beginning of your application:
System.setProperty("http.keepAlive", "false");