Getting IOException while working with the Reading data from Nest API


#1

I am working on one Android Application which is consuming the Nest services.
I am hitting “https://developer-nest.com” with my access token.
I am have implemented it as per the document mentioned on below url
developers.nest.com/guides/api/how-to-read-data

With the help of above implementation I am getting data sometimes and getting IOException sometime. Please refer following gist of my code and exception

I am not able to understand how I can handle this issue.

Note: As per some stackoverflow thread I have even tried to add (“Connection”,“close”) into headers but still I am facing the same issue.

Could someone help me in fixing this issue?