Package com.twitter.hbc.httpclient

Examples of com.twitter.hbc.httpclient.ControlStreamException


  @VisibleForTesting
  HttpResponse makeControlStreamRequest(HttpUriRequest request) throws IOException, ControlStreamException {
    HttpResponse response = client.execute(request);
    if (response.getStatusLine() == null) {
      throw new ControlStreamException("No status line in response");
    }
    logger.debug("{} returned with status line: {}", request.getURI(), response.getStatusLine());
    if (response.getStatusLine().getStatusCode() != HttpConstants.Codes.SUCCESS) {
      logger.warn("{} returned with status code {}", request.getURI(), response.getStatusLine().getStatusCode());
      if (response.getEntity() != null) {
        // close the resources if the request failed. this might be redundant
        EntityUtils.consume(response.getEntity());
      }
      throw new ControlStreamException(response.getStatusLine());
    }
    return response;
  }
View Full Code Here

TOP

Related Classes of com.twitter.hbc.httpclient.ControlStreamException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.