Java Code Examples for io.netty.handler.codec.socksx.v4.Socks4CommandStatus#SUCCESS

The following examples show how to use io.netty.handler.codec.socksx.v4.Socks4CommandStatus#SUCCESS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProxyToServerConnection.java    From PowerTunnel with MIT License 5 votes vote down vote up
@Override
void read(ConnectionFlow flow, Object msg) {
    removeHandlerIfPresent(SOCKS_ENCODER_NAME);
    removeHandlerIfPresent(SOCKS_DECODER_NAME);
    if (msg instanceof Socks4CommandResponse) {
        if (((Socks4CommandResponse) msg).status() == Socks4CommandStatus.SUCCESS) {
            flow.advance();
            return;
        }
    }
    flow.fail();
}
 
Example 2
Source File: Socks4ProxyHandler.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean handleResponse(ChannelHandlerContext ctx, Object response) throws Exception {
    final Socks4CommandResponse res = (Socks4CommandResponse) response;
    final Socks4CommandStatus status = res.status();
    if (status == Socks4CommandStatus.SUCCESS) {
        return true;
    }

    throw new ProxyConnectException(exceptionMessage("status: " + status));
}