Getting IOException while working with the Reading data from Nest API


I am working on one Android Application which is consuming the Nest services.
I am hitting “” with my access token.
I am have implemented it as per the document mentioned on below url

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?