Hi All,

Below is my problem scenario.

 - My Server is on running on https.
 - Doing connection with ‘HttpURLConnection’ api & already tried
‘HttpClient’ as well earlier but both are showing same issue.
 - Server certificate is ‘Verisign Class
   3’ certificate.
 - Every alternate request sent to
   server, receives ‘-1’ in http
   response code. For e.g. If my first
   request is successful (200 code)
   second request would get (-1) code,
   then again successful & then again
   4th request gets -1 in response.  I’m
   not sure why this -1 code is returned
   & there’s not description on HTTP
   standard site as well.

Any idea how can i get rid off this '-1' response i receive. In which
scenario server returns this code?

I'm posting my sample code below.

----------
HttpURLConnection connection;
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, new TrustManager[] { new TrustManager() },
        new SecureRandom());
        
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(new
MyHostnameVerifier());
connection = (HttpsURLConnection) httpUrl.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Length", String
                                        .valueOf(requestBinary.length));
connection.setRequestProperty("Content-Type",
                                "octet/x-application-csam");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setConnectTimeout(30000);
connection.connect();
connection.getOutputStream().write(requestBinary);
int responseCode = connection.getResponseCode();
----------

Thanks in advance

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to