private String response ( HttpURLConnection connection ) throws LightblueHttpClientException { try ( InputStream responseStream = connection . getInputStream ( ) ) { return readResponseStream ( responseStream , connection ) ; } catch ( IOException e ) { return readErrorStream ( connection , e ) ; } }
Parses response whether or not the request was successful if possible . Reads entire input stream and closes it so the socket knows it is finished and may be put back into a pool for reuse .