Home / Class/ Java8SslTestUtils Class — netty Architecture

Java8SslTestUtils Class — netty Architecture

Architecture documentation for the Java8SslTestUtils class in Java8SslTestUtils.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0f6846ac_7487_9549_2d6d_35fbf536c0a3["Java8SslTestUtils"]
  ac7cdf84_4335_6f57_48d0_93e1a992c648["Java8SslTestUtils.java"]
  0f6846ac_7487_9549_2d6d_35fbf536c0a3 -->|defined in| ac7cdf84_4335_6f57_48d0_93e1a992c648
  5000c15f_6149_cb8d_b847_b66395236933["Java8SslTestUtils()"]
  0f6846ac_7487_9549_2d6d_35fbf536c0a3 -->|method| 5000c15f_6149_cb8d_b847_b66395236933
  8ede6e06_6ccf_2168_ebe2_66a715f20e69["setSNIMatcher()"]
  0f6846ac_7487_9549_2d6d_35fbf536c0a3 -->|method| 8ede6e06_6ccf_2168_ebe2_66a715f20e69
  d059afa9_b137_816e_2887_02e2dd3aabd7["Provider()"]
  0f6846ac_7487_9549_2d6d_35fbf536c0a3 -->|method| d059afa9_b137_816e_2887_02e2dd3aabd7
  9367cb82_b11c_7a69_b164_a279550c3b68["SSLEngine()"]
  0f6846ac_7487_9549_2d6d_35fbf536c0a3 -->|method| 9367cb82_b11c_7a69_b164_a279550c3b68
  f9177407_f9ac_c507_b678_79dcd2c28e7b["loadCertCollection()"]
  0f6846ac_7487_9549_2d6d_35fbf536c0a3 -->|method| f9177407_f9ac_c507_b678_79dcd2c28e7b

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/Java8SslTestUtils.java lines 34–78

public final class Java8SslTestUtils {

    private Java8SslTestUtils() { }

    static void setSNIMatcher(SSLParameters parameters, final byte[] match) {
        SNIMatcher matcher = new SNIMatcher(0) {
            @Override
            public boolean matches(SNIServerName sniServerName) {
                return Arrays.equals(match, sniServerName.getEncoded());
            }
        };
        parameters.setSNIMatchers(Collections.singleton(matcher));
    }

    static Provider conscryptProvider() {
        return new OpenSSLProvider();
    }

    /**
     * Wraps the given {@link SSLEngine} to add extra tests while executing methods if possible / needed.
     */
    static SSLEngine wrapSSLEngineForTesting(SSLEngine engine) {
        if (engine instanceof ReferenceCountedOpenSslEngine) {
            return new OpenSslErrorStackAssertSSLEngine((ReferenceCountedOpenSslEngine) engine);
        }
        return engine;
    }

    public static X509Certificate[] loadCertCollection(String... resourceNames)
            throws Exception {
        CertificateFactory certFactory = CertificateFactory
                .getInstance("X.509");

        X509Certificate[] certCollection = new X509Certificate[resourceNames.length];
        for (int i = 0; i < resourceNames.length; i++) {
            String resourceName = resourceNames[i];
            try (InputStream is = SslContextTest.class.getResourceAsStream(resourceName)) {
                assertNotNull(is, "Cannot find " + resourceName);
                certCollection[i] = (X509Certificate) certFactory
                        .generateCertificate(is);
            }
        }
        return certCollection;
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free