Package org.apache.http

Examples of org.apache.http.ConnectionClosedException


        if (pos + len > contentLength) {
            len = (int) (contentLength - pos);
        }
        int count = this.in.read(b, off, len);
        if (count == -1 && pos < contentLength) {
            throw new ConnectionClosedException(
                    "Premature end of Content-Length delimited message body (expected: "
                    + contentLength + "; received: " + pos);
        }
        if (count > 0) {
            pos += count;
View Full Code Here


            final HttpAsyncClientExchangeHandler handler = getHandler(conn);
            if (handler != null) {
                if (state.isValid()) {
                    handler.inputTerminated();
                } else {
                    handler.failed(new ConnectionClosedException("Connection closed"));
                }
            }
        }
        // Closing connection in an orderly manner and
        // waiting for output buffer to get flushed.
View Full Code Here

            }
        }
        if (bytesRead == -1) {
            this.completed = true;
            if (this.len < this.contentLength) {
                throw new ConnectionClosedException(
                        "Premature end of Content-Length delimited message body (expected: "
                        + this.contentLength + "; received: " + this.len);
            }
        }
        this.len += bytesRead;
View Full Code Here

            }
        }
        if (bytesRead == -1) {
            this.completed = true;
            if (this.len < this.contentLength) {
                throw new ConnectionClosedException(
                        "Premature end of Content-Length delimited message body (expected: "
                        + this.contentLength + "; received: " + this.len);
            }
        }
        this.len += bytesRead;
View Full Code Here

     * @throws ConnectionClosedException in case the connection has already
     *   been closed.
     */
    protected void assertNotClosed() throws ConnectionClosedException {
        if (this.status != ACTIVE) {
            throw new ConnectionClosedException("Connection is closed");
        }
    }
View Full Code Here

    private RequestLine parseRequestLine(final SessionInputBuffer sessionBuffer) throws IOException, HttpException, ParseException {
        lineBuf.clear();
        int i = sessionBuffer.readLine(lineBuf);
        if (i == -1) {
            throw new ConnectionClosedException("Client closed connection");
        }
        ParserCursor cursor = new ParserCursor(0, lineBuf.length());
        return lineParser.parseRequestLine(lineBuf, cursor);
    }
View Full Code Here

    public void endOfInput(final NHttpClientConnection conn) throws IOException {
        State state = getState(conn);
        if (state != null) {
            if (state.getRequestState().compareTo(MessageState.READY) != 0) {
                state.invalidate();
                closeHandler(getHandler(conn), new ConnectionClosedException("Connection closed"));
            }
        }
        conn.close();
    }
View Full Code Here

     * @throws ConnectionClosedException in case the connection has already
     *   been closed.
     */
    protected void assertNotClosed() throws ConnectionClosedException {
        if (this.status != ACTIVE) {
            throw new ConnectionClosedException("Connection is closed");
        }
    }
View Full Code Here

    private <T> void initExection(
            final HttpAsyncRequestExecutionHandler<T> handler, final NHttpClientConnection conn) {
        conn.getContext().setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, handler);
        conn.requestOutput();
        if (!conn.isOpen()) {
            handler.failed(new ConnectionClosedException("Connection closed"));
            try {
                handler.close();
            } catch (IOException ex) {
                log(ex);
            }
View Full Code Here

            }
        }
        if (bytesRead == -1) {
            this.completed = true;
            if (this.len < this.contentLength) {
                throw new ConnectionClosedException(
                        "Premature end of Content-Length delimited message body (expected: "
                        + this.contentLength + "; received: " + this.len);
            }
        }
        this.len += bytesRead;
View Full Code Here

TOP

Related Classes of org.apache.http.ConnectionClosedException

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.