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();
}
}
}
});
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations