I met the same issue, have you found a solution for that?

On 20 mai, 16:17, Binesy <[email protected]> wrote:
> Hi
>
> I have been working with theHttpsUrlConnectionclass and have found
> an interesting issue, it seems to fail on every other connection.  The
> first request connects to the server successfully but the second one
> always fails.  Any ideas on what i may be doing wrong.  Here is my
> code.
>
> Many Thanks
>
> HttpsURLConnectionhttpConnection = null;
>                 InputStream is = null;
>
>                 try {
>                         httpConnection = (HttpsURLConnection) new 
> URL(url).openConnection
> ();
>                         httpConnection.setRequestProperty( "User-Agent", 
> "Mozilla/5.0
> (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/
> 2.0.0.1" );
>
>                         httpConnection.setHostnameVerifier(new 
> HostnameVerifier() {
>                                 public boolean verify(String hostname, 
> SSLSession session) {
>                                         return true;
>                                 }
>                         });
>
>                         httpConnection.setDoOutput(true);
>                         httpConnection.setDoInput(true);
>                         httpConnection.setUseCaches(false);
>                         httpConnection.setRequestProperty("Authorization", 
> "Basic " +
> Base64Encoder.encode(username, password));
>
>                         is = httpConnection.getInputStream();
>                         return parseXmlData(is, type);
>                 }
>                 catch (MalformedURLException e) {
>                         e.printStackTrace();
>                 }
>                 catch (IOException e) {
>                         e.printStackTrace();
>                 }
>                 finally {
>                         if(is != null) {
>                                 try {
>
>                                         is.close();
>                                 } catch (IOException e) {
>                                         e.printStackTrace();
>                                 }
>
>                                 is = null;
>                         }
>
>                         if(httpConnection != null) {
>                                 httpConnection.disconnect();
>                                 httpConnection = null;
>                         }
>                 }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to