PemEncodedTest Class — netty Architecture
Architecture documentation for the PemEncodedTest class in PemEncodedTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a7eead45_1a46_cd41_3122_e32aee5e59fd["PemEncodedTest"] 64f40460_4a91_83b1_ba2a_ca71793fd156["PemEncodedTest.java"] a7eead45_1a46_cd41_3122_e32aee5e59fd -->|defined in| 64f40460_4a91_83b1_ba2a_ca71793fd156 b2b0897b_811f_0441_3302_63a191b8afad["testPemEncodedOpenSsl()"] a7eead45_1a46_cd41_3122_e32aee5e59fd -->|method| b2b0897b_811f_0441_3302_63a191b8afad dc4cc129_32a5_4ffe_2c6c_f6c37ce9fc1e["testPemEncodedOpenSslRef()"] a7eead45_1a46_cd41_3122_e32aee5e59fd -->|method| dc4cc129_32a5_4ffe_2c6c_f6c37ce9fc1e b3b64bbf_529a_4f83_63f3_6943492d73a7["testPemEncoded()"] a7eead45_1a46_cd41_3122_e32aee5e59fd -->|method| b3b64bbf_529a_4f83_63f3_6943492d73a7 8771f284_8600_a48a_c035_ab05f12cb62d["testEncodedReturnsNull()"] a7eead45_1a46_cd41_3122_e32aee5e59fd -->|method| 8771f284_8600_a48a_c035_ab05f12cb62d 3163a23b_477a_84d6_c75c_e186d288de4b["assertRelease()"] a7eead45_1a46_cd41_3122_e32aee5e59fd -->|method| 3163a23b_477a_84d6_c75c_e186d288de4b
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/ssl/PemEncodedTest.java lines 36–98
public class PemEncodedTest {
@Test
public void testPemEncodedOpenSsl() throws Exception {
testPemEncoded(SslProvider.OPENSSL);
}
@Test
public void testPemEncodedOpenSslRef() throws Exception {
testPemEncoded(SslProvider.OPENSSL_REFCNT);
}
private static void testPemEncoded(SslProvider provider) throws Exception {
OpenSsl.ensureAvailability();
assumeFalse(OpenSsl.useKeyManagerFactory());
SelfSignedCertificate ssc = CachedSelfSignedCertificate.getCachedCertificate();
PemPrivateKey pemKey = PemPrivateKey.valueOf(Files.readAllBytes(ssc.privateKey().toPath()));
PemX509Certificate pemCert = PemX509Certificate.valueOf(Files.readAllBytes(ssc.certificate().toPath()));
SslContext context = SslContextBuilder.forServer(pemKey, pemCert)
.sslProvider(provider)
.build();
assertEquals(1, pemKey.refCnt());
assertEquals(1, pemCert.refCnt());
try {
assertInstanceOf(ReferenceCountedOpenSslContext.class, context);
} finally {
ReferenceCountUtil.release(context);
assertRelease(pemKey);
assertRelease(pemCert);
}
}
@Test
public void testEncodedReturnsNull() throws Exception {
assertThrows(IllegalArgumentException.class, new Executable() {
@Override
public void execute() throws Throwable {
PemPrivateKey.toPEM(UnpooledByteBufAllocator.DEFAULT, true, new PrivateKey() {
@Override
public String getAlgorithm() {
return null;
}
@Override
public String getFormat() {
return null;
}
@Override
public byte[] getEncoded() {
return null;
}
});
}
});
}
private static void assertRelease(PemEncoded encoded) {
assertTrue(encoded.release());
}
}
Source
Frequently Asked Questions
What is the PemEncodedTest class?
PemEncodedTest is a class in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/PemEncodedTest.java.
Where is PemEncodedTest defined?
PemEncodedTest is defined in handler/src/test/java/io/netty/handler/ssl/PemEncodedTest.java at line 36.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free