Code example for BasicHeader

0
                new ProtocolVersion("HTTP",1,1), 400, "Unauthorized"));
        InputStreamEntity inputStreamEntity = new InputStreamEntity(
                new ByteArrayInputStream(errorString.getBytes()),
                errorString.getBytes().length);
        httpResponse.setEntity(inputStreamEntity);
        httpResponse.setHeader(new BasicHeader(CONTENT_TYPE_KEY,
                                               CONTENT_TYPE_TEXT_HTML));
 
        ScheduleAPIResponseHandler handler = new ScheduleAPIResponseHandler();
 
        try{ 
            handler.handleResponse(httpResponse);
        } 
        catch (APIRequestException ex){
            APIError error = ex.getError().get();
            assertTrue("String error message is incorrect", 
                       error.getError().equals("Unauthorized"));
            return; 
        } 
        catch (Exception ex){