Example usage for io.netty.handler.proxy ProxyConnectException ProxyConnectException

List of usage examples for io.netty.handler.proxy ProxyConnectException ProxyConnectException

Introduction

In this page you can find the example usage for io.netty.handler.proxy ProxyConnectException ProxyConnectException.

Prototype

public ProxyConnectException(Throwable cause) 

Source Link

Usage

From source file:com.otcdlink.chiron.downend.Http11ProxyHandler.java

License:Apache License

@Override
protected boolean handleResponse(ChannelHandlerContext ctx, Object response) throws Exception {
    if (response instanceof HttpResponse) {
        if (status != null) {
            throw new ProxyConnectException(exceptionMessage("too many responses"));
        }/*from   ww  w.j av  a  2s .co m*/
        status = ((HttpResponse) response).status();
    }

    boolean finished = response instanceof LastHttpContent;
    if (finished) {
        if (status == null) {
            throw new ProxyConnectException(exceptionMessage("missing response"));
        }
        if (status.code() != 200) {
            throw new ProxyConnectException(exceptionMessage("status: " + status));
        }
    }

    return finished;
}