InsecureQuicTokenHandlerTest Class — netty Architecture
Architecture documentation for the InsecureQuicTokenHandlerTest class in InsecureQuicTokenHandlerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3e9f9a96_1493_8d4b_dcc7_01a24738279d["InsecureQuicTokenHandlerTest"] 602ac2cf_3ddf_cc64_bd7f_459799518a29["InsecureQuicTokenHandlerTest.java"] 3e9f9a96_1493_8d4b_dcc7_01a24738279d -->|defined in| 602ac2cf_3ddf_cc64_bd7f_459799518a29 5ef6880b_26cc_8d40_42d5_21dc12e61e22["testMaxTokenLength()"] 3e9f9a96_1493_8d4b_dcc7_01a24738279d -->|method| 5ef6880b_26cc_8d40_42d5_21dc12e61e22 df279b8b_1d37_b2a6_bae4_b7ee63199bd6["testTokenProcessingIpv4()"] 3e9f9a96_1493_8d4b_dcc7_01a24738279d -->|method| df279b8b_1d37_b2a6_bae4_b7ee63199bd6 f1760f66_c459_2552_ba30_158862fbbcac["testTokenProcessingIpv6()"] 3e9f9a96_1493_8d4b_dcc7_01a24738279d -->|method| f1760f66_c459_2552_ba30_158862fbbcac c66bf011_7879_8e09_b293_947636f716a7["testTokenProcessing()"] 3e9f9a96_1493_8d4b_dcc7_01a24738279d -->|method| c66bf011_7879_8e09_b293_947636f716a7
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/InsecureQuicTokenHandlerTest.java lines 32–80
public class InsecureQuicTokenHandlerTest extends AbstractQuicTest {
@Test
public void testMaxTokenLength() {
assertEquals(InsecureQuicTokenHandler.MAX_TOKEN_LEN, InsecureQuicTokenHandler.INSTANCE.maxTokenLength());
}
@Test
public void testTokenProcessingIpv4() throws UnknownHostException {
testTokenProcessing(true);
}
@Test
public void testTokenProcessingIpv6() throws UnknownHostException {
testTokenProcessing(false);
}
private static void testTokenProcessing(boolean ipv4) throws UnknownHostException {
byte[] bytes = new byte[Quiche.QUICHE_MAX_CONN_ID_LEN];
ThreadLocalRandom.current().nextBytes(bytes);
ByteBuf dcid = Unpooled.wrappedBuffer(bytes);
ByteBuf out = Unpooled.buffer();
try {
final InetSocketAddress validAddress;
final InetSocketAddress invalidAddress;
if (ipv4) {
validAddress = new InetSocketAddress(
InetAddress.getByAddress(new byte[] { 10, 10, 10, 1}), 9999);
invalidAddress = new InetSocketAddress(
InetAddress.getByAddress(new byte[] { 10, 10, 10, 10}), 9999);
} else {
validAddress = new InetSocketAddress(InetAddress.getByAddress(
new byte[] { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1}), 9999);
invalidAddress = new InetSocketAddress(InetAddress.getByAddress(
new byte[] { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}), 9999);
}
InsecureQuicTokenHandler.INSTANCE.writeToken(out, dcid, validAddress);
assertThat(out.readableBytes()).isLessThanOrEqualTo(InsecureQuicTokenHandler.INSTANCE.maxTokenLength());
assertNotEquals(-1, InsecureQuicTokenHandler.INSTANCE.validateToken(out, validAddress));
// Use another address and check that the validate fails.
assertEquals(-1, InsecureQuicTokenHandler.INSTANCE.validateToken(out, invalidAddress));
} finally {
dcid.release();
out.release();
}
}
}
Defined In
Source
Frequently Asked Questions
What is the InsecureQuicTokenHandlerTest class?
InsecureQuicTokenHandlerTest is a class in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/InsecureQuicTokenHandlerTest.java.
Where is InsecureQuicTokenHandlerTest defined?
InsecureQuicTokenHandlerTest is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/InsecureQuicTokenHandlerTest.java at line 32.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free