Home / Class/ AlertValidationHandler Class — netty Architecture

AlertValidationHandler Class — netty Architecture

Architecture documentation for the AlertValidationHandler class in SslErrorTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9d6c5264_041f_d48d_96ff_9270dbf2d5b2["AlertValidationHandler"]
  9f113343_96ee_ca58_c1eb_a2480db3e007["SslErrorTest.java"]
  9d6c5264_041f_d48d_96ff_9270dbf2d5b2 -->|defined in| 9f113343_96ee_ca58_c1eb_a2480db3e007
  08d587d4_3997_80f5_c5e8_89d3963066cf["AlertValidationHandler()"]
  9d6c5264_041f_d48d_96ff_9270dbf2d5b2 -->|method| 08d587d4_3997_80f5_c5e8_89d3963066cf
  5fd671a5_e3f0_0904_b972_222bc3b5f444["exceptionCaught()"]
  9d6c5264_041f_d48d_96ff_9270dbf2d5b2 -->|method| 5fd671a5_e3f0_0904_b972_222bc3b5f444

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SslErrorTest.java lines 240–280

    private static final class AlertValidationHandler extends ChannelInboundHandlerAdapter {
        private final SslProvider clientProvider;
        private final boolean serverProduceError;
        private final CertificateException exception;
        private final Promise<Void> promise;

        AlertValidationHandler(SslProvider clientProvider, boolean serverProduceError,
                               CertificateException exception, Promise<Void> promise) {
            this.clientProvider = clientProvider;
            this.serverProduceError = serverProduceError;
            this.exception = exception;
            this.promise = promise;
        }

        @Override
        public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
            // Unwrap as its wrapped by a DecoderException
            Throwable unwrappedCause = cause.getCause();
            if (unwrappedCause instanceof SSLException) {
                if (exception instanceof TestCertificateException) {
                    CertPathValidatorException.Reason reason =
                            ((CertPathValidatorException) exception.getCause()).getReason();
                    if (reason == CertPathValidatorException.BasicReason.EXPIRED) {
                        verifyException(clientProvider, serverProduceError, unwrappedCause, promise, "expired");
                    } else if (reason == CertPathValidatorException.BasicReason.NOT_YET_VALID) {
                        // BoringSSL may use "expired" in this case while others use "bad"
                        verifyException(clientProvider, serverProduceError, unwrappedCause, promise, "expired", "bad");
                    } else if (reason == CertPathValidatorException.BasicReason.REVOKED) {
                        verifyException(clientProvider, serverProduceError, unwrappedCause, promise, "revoked");
                    }
                } else if (exception instanceof CertificateExpiredException) {
                    verifyException(clientProvider, serverProduceError, unwrappedCause, promise,  "expired");
                } else if (exception instanceof CertificateNotYetValidException) {
                    // BoringSSL may use "expired" in this case while others use "bad"
                    verifyException(clientProvider, serverProduceError, unwrappedCause, promise, "expired", "bad");
                } else if (exception instanceof CertificateRevokedException) {
                    verifyException(clientProvider, serverProduceError, unwrappedCause, promise, "revoked");
                }
            }
        }
    }

Frequently Asked Questions

What is the AlertValidationHandler class?
AlertValidationHandler is a class in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SslErrorTest.java.
Where is AlertValidationHandler defined?
AlertValidationHandler is defined in handler/src/test/java/io/netty/handler/ssl/SslErrorTest.java at line 240.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free