Home / Type/ ProviderType Type — netty Architecture

ProviderType Type — netty Architecture

Architecture documentation for the ProviderType type/interface in JdkSslEngineTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e940ddab_b8ca_8aaf_3b4a_f6190e97ecd6["ProviderType"]
  e624c181_478b_3b9a_d700_a3ea418318cb["JdkSslEngineTest.java"]
  e940ddab_b8ca_8aaf_3b4a_f6190e97ecd6 -->|defined in| e624c181_478b_3b9a_d700_a3ea418318cb
  style e940ddab_b8ca_8aaf_3b4a_f6190e97ecd6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/JdkSslEngineTest.java lines 45–103

    public enum ProviderType {
        ALPN_JAVA {
            @Override
            boolean isAvailable() {
                return JdkAlpnSslUtils.supportsAlpn();
            }

            @Override
            Protocol protocol() {
                return Protocol.ALPN;
            }

            @Override
            Provider provider() {
                // Use the default provider.
                return null;
            }
        },
        ALPN_CONSCRYPT {
            private Provider provider;

            @Override
            boolean isAvailable() {
                return Conscrypt.isAvailable();
            }

            @Override
            Protocol protocol() {
                return Protocol.ALPN;
            }

            @Override
            Provider provider() {
                try {
                    if (provider == null) {
                        provider = (Provider) Class.forName("org.conscrypt.OpenSSLProvider")
                            .getConstructor().newInstance();
                    }
                    return provider;
                } catch (Exception e) {
                    throw new IllegalStateException(e);
                }
            }
        };

        abstract boolean isAvailable();
        abstract Protocol protocol();
        abstract Provider provider();

        final void activate(JdkSslEngineTest instance) {
            // Typical code will not have to check this, but will get a initialization error on class load.
            // Check in this test just in case we have multiple tests that just the class and we already ignored the
            // initialization error.
            if (!isAvailable()) {
                throw tlsExtensionNotFound(protocol());
            }
            instance.provider = provider();
        }
    }

Frequently Asked Questions

What is the ProviderType type?
ProviderType is a type/interface in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/JdkSslEngineTest.java.
Where is ProviderType defined?
ProviderType is defined in handler/src/test/java/io/netty/handler/ssl/JdkSslEngineTest.java at line 45.

Analyze Your Own Codebase

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

Try Supermodel Free