Search in sources :

Example 1 with DecoderException

use of io.netty.handler.codec.DecoderException in project netty by netty.

the class SniHandler method select.

private void select(final ChannelHandlerContext ctx, final String hostname) throws Exception {
    Future<SslContext> future = lookup(ctx, hostname);
    if (future.isDone()) {
        if (future.isSuccess()) {
            onSslContext(ctx, hostname, future.getNow());
        } else {
            throw new DecoderException("failed to get the SslContext for " + hostname, future.cause());
        }
    } else {
        suppressRead = true;
        future.addListener(new FutureListener<SslContext>() {

            @Override
            public void operationComplete(Future<SslContext> future) throws Exception {
                try {
                    suppressRead = false;
                    if (future.isSuccess()) {
                        try {
                            onSslContext(ctx, hostname, future.getNow());
                        } catch (Throwable cause) {
                            ctx.fireExceptionCaught(new DecoderException(cause));
                        }
                    } else {
                        ctx.fireExceptionCaught(new DecoderException("failed to get the SslContext for " + hostname, future.cause()));
                    }
                } finally {
                    if (readPending) {
                        readPending = false;
                        ctx.read();
                    }
                }
            }
        });
    }
}
Also used : DecoderException(io.netty.handler.codec.DecoderException) DecoderException(io.netty.handler.codec.DecoderException)

Example 2 with DecoderException

use of io.netty.handler.codec.DecoderException in project netty by netty.

the class Socks5CommandResponseDecoder method fail.

private void fail(List<Object> out, Throwable cause) {
    if (!(cause instanceof DecoderException)) {
        cause = new DecoderException(cause);
    }
    checkpoint(State.FAILURE);
    Socks5Message m = new DefaultSocks5CommandResponse(Socks5CommandStatus.FAILURE, Socks5AddressType.IPv4, null, 0);
    m.setDecoderResult(DecoderResult.failure(cause));
    out.add(m);
}
Also used : DecoderException(io.netty.handler.codec.DecoderException)

Example 3 with DecoderException

use of io.netty.handler.codec.DecoderException in project netty by netty.

the class Socks5InitialResponseDecoder method fail.

private void fail(List<Object> out, Throwable cause) {
    if (!(cause instanceof DecoderException)) {
        cause = new DecoderException(cause);
    }
    checkpoint(State.FAILURE);
    Socks5Message m = new DefaultSocks5InitialResponse(Socks5AuthMethod.UNACCEPTED);
    m.setDecoderResult(DecoderResult.failure(cause));
    out.add(m);
}
Also used : DecoderException(io.netty.handler.codec.DecoderException)

Example 4 with DecoderException

use of io.netty.handler.codec.DecoderException in project netty by netty.

the class Socks5PasswordAuthRequestDecoder method fail.

private void fail(List<Object> out, Throwable cause) {
    if (!(cause instanceof DecoderException)) {
        cause = new DecoderException(cause);
    }
    checkpoint(State.FAILURE);
    Socks5Message m = new DefaultSocks5PasswordAuthRequest("", "");
    m.setDecoderResult(DecoderResult.failure(cause));
    out.add(m);
}
Also used : DecoderException(io.netty.handler.codec.DecoderException)

Example 5 with DecoderException

use of io.netty.handler.codec.DecoderException in project netty by netty.

the class Socks5PasswordAuthResponseDecoder method fail.

private void fail(List<Object> out, Throwable cause) {
    if (!(cause instanceof DecoderException)) {
        cause = new DecoderException(cause);
    }
    checkpoint(State.FAILURE);
    Socks5Message m = new DefaultSocks5PasswordAuthResponse(Socks5PasswordAuthStatus.FAILURE);
    m.setDecoderResult(DecoderResult.failure(cause));
    out.add(m);
}
Also used : DecoderException(io.netty.handler.codec.DecoderException)

Aggregations

DecoderException (io.netty.handler.codec.DecoderException)46 ByteBuf (io.netty.buffer.ByteBuf)6 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)5 ClosedChannelException (java.nio.channels.ClosedChannelException)4 SSLHandshakeException (javax.net.ssl.SSLHandshakeException)4 Channel (io.netty.channel.Channel)3 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)3 Test (org.junit.jupiter.api.Test)3 ChannelInboundHandlerAdapter (io.netty.channel.ChannelInboundHandlerAdapter)2 TooLongFrameException (io.netty.handler.codec.TooLongFrameException)2 DomainNameMappingBuilder (io.netty.util.DomainNameMappingBuilder)2 IOException (java.io.IOException)2 SSLException (javax.net.ssl.SSLException)2 Test (org.junit.Test)2 Vector3d (com.flowpowered.math.vector.Vector3d)1 Vector3i (com.flowpowered.math.vector.Vector3i)1 ApiError (com.nike.backstopper.apierror.ApiError)1 ApiErrorWithMetadata (com.nike.backstopper.apierror.ApiErrorWithMetadata)1 CircuitBreakerException (com.nike.fastbreak.exception.CircuitBreakerException)1 Pair (com.nike.internal.util.Pair)1