Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3619

java.io.IOException: unexpected end of stream on Connection in android

$
0
0

I have web service URL, it working fine. It gives the JSON data.

When I am using HttpURLConnection and InputStream, I am getting this error:

java.io.IOException: unexpected end of stream onConnection{comenius-api.sabacloud.com:443, proxy=DIRECThostAddress=12.130.57.1cipherSuite=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 protocol=http/1.1}(recycle count=0)

My code:

try {    URL url = new URL("https://comenius-api.sabacloud.com/v1/people/username="+ username +":(internalWorkHistory)?type=internal&SabaCertificate="+ certificate);    HttpURLConnection con = (HttpURLConnection) url.openConnection();    InputStream ist = con.getInputStream();    BufferedReader reader = new BufferedReader(new InputStreamReader(ist));    while ((singleLine = reader.readLine()) != null) {        data = data + singleLine;        Log.e("Response", data);    }} catch (Exception e) {    e.printStackTrace();}

How to fix this?


Viewing all articles
Browse latest Browse all 3619

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>