Code example for SessionInputBuffer

Methods: readLine

0
        this.lineBuf.clear();
        //read out the HTTP status string 
        int count = 0;
        ParserCursor cursor = null;
        do { 
            int i = sessionBuffer.readLine(this.lineBuf);
            if (i == -1 && count == 0) {
                // The server just dropped connection on us 
                throw new NoHttpResponseException("The target server failed to respond");
            } 
            cursor = new ParserCursor(0, this.lineBuf.length());
            if (lineParser.hasProtocolVersion(this.lineBuf, cursor)) {
                // Got one 
                break; 
            } else if (i == -1 || count >= this.maxGarbageLines) {
                // Giving up 
                throw new ProtocolException("The server failed to respond with a " +
                        "valid HTTP response"); 
            } 
            count++;