QuicConnectionIdGeneratorTest Class — netty Architecture
Architecture documentation for the QuicConnectionIdGeneratorTest class in QuicConnectionIdGeneratorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 0c6761d6_a118_49ca_d21a_23b24fe8ec90["QuicConnectionIdGeneratorTest"] 17de7fab_999e_3c69_5700_65b37351197b["QuicConnectionIdGeneratorTest.java"] 0c6761d6_a118_49ca_d21a_23b24fe8ec90 -->|defined in| 17de7fab_999e_3c69_5700_65b37351197b 913bfdd2_6830_91f4_5fae_6c166c07eafc["testRandomness()"] 0c6761d6_a118_49ca_d21a_23b24fe8ec90 -->|method| 913bfdd2_6830_91f4_5fae_6c166c07eafc 18bb98d8_1659_c752_89f7_9f4495cf5e66["testThrowsIfInputTooBig()"] 0c6761d6_a118_49ca_d21a_23b24fe8ec90 -->|method| 18bb98d8_1659_c752_89f7_9f4495cf5e66 1cbabee1_74cb_b39a_37df_4af756b03c29["testThrowsIfInputTooBig2()"] 0c6761d6_a118_49ca_d21a_23b24fe8ec90 -->|method| 1cbabee1_74cb_b39a_37df_4af756b03c29 23d93d58_7b49_059d_eba3_f378613e6c03["testSignIdGenerator()"] 0c6761d6_a118_49ca_d21a_23b24fe8ec90 -->|method| 23d93d58_7b49_059d_eba3_f378613e6c03
Relationship Graph
Source Code
codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicConnectionIdGeneratorTest.java lines 28–90
public class QuicConnectionIdGeneratorTest extends AbstractQuicTest {
@Test
public void testRandomness() {
QuicConnectionIdGenerator idGenerator = QuicConnectionIdGenerator.randomGenerator();
ByteBuffer id = idGenerator.newId(Quiche.QUICHE_MAX_CONN_ID_LEN);
ByteBuffer id2 = idGenerator.newId(Quiche.QUICHE_MAX_CONN_ID_LEN);
assertThat(id.remaining()).isGreaterThan(0);
assertThat(id2.remaining()).isGreaterThan(0);
assertNotEquals(id, id2);
id = idGenerator.newId(10);
id2 = idGenerator.newId(10);
assertEquals(10, id.remaining());
assertEquals(10, id2.remaining());
assertNotEquals(id, id2);
byte[] input = new byte[1024];
ThreadLocalRandom.current().nextBytes(input);
id = idGenerator.newId(ByteBuffer.wrap(input), 10);
id2 = idGenerator.newId(ByteBuffer.wrap(input), 10);
assertEquals(10, id.remaining());
assertEquals(10, id2.remaining());
assertNotEquals(id, id2);
}
@Test
public void testThrowsIfInputTooBig() {
QuicConnectionIdGenerator idGenerator = QuicConnectionIdGenerator.randomGenerator();
assertThrows(IllegalArgumentException.class, () -> idGenerator.newId(Integer.MAX_VALUE));
}
@Test
public void testThrowsIfInputTooBig2() {
QuicConnectionIdGenerator idGenerator = QuicConnectionIdGenerator.randomGenerator();
assertThrows(IllegalArgumentException.class, () ->
idGenerator.newId(ByteBuffer.wrap(new byte[8]), Integer.MAX_VALUE));
}
@Test
public void testSignIdGenerator() {
QuicConnectionIdGenerator idGenerator = QuicConnectionIdGenerator.signGenerator();
byte[] input = new byte[1024];
byte[] input2 = new byte[1024];
ThreadLocalRandom.current().nextBytes(input);
ThreadLocalRandom.current().nextBytes(input2);
ByteBuffer id = idGenerator.newId(ByteBuffer.wrap(input), 10);
ByteBuffer id2 = idGenerator.newId(ByteBuffer.wrap(input), 10);
ByteBuffer id3 = idGenerator.newId(ByteBuffer.wrap(input2), 10);
assertEquals(10, id.remaining());
assertEquals(10, id2.remaining());
assertEquals(10, id3.remaining());
assertEquals(id, id2);
assertNotEquals(id, id3);
assertThrows(UnsupportedOperationException.class, () -> idGenerator.newId(10));
assertThrows(NullPointerException.class, () -> idGenerator.newId(null, 10));
assertThrows(IllegalArgumentException.class, () -> idGenerator.newId(ByteBuffer.wrap(new byte[0]), 10));
assertThrows(IllegalArgumentException.class, () ->
idGenerator.newId(ByteBuffer.wrap(input), Integer.MAX_VALUE));
}
}
Defined In
Source
Frequently Asked Questions
What is the QuicConnectionIdGeneratorTest class?
QuicConnectionIdGeneratorTest is a class in the netty codebase, defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicConnectionIdGeneratorTest.java.
Where is QuicConnectionIdGeneratorTest defined?
QuicConnectionIdGeneratorTest is defined in codec-native-quic/src/test/java/io/netty/handler/codec/quic/QuicConnectionIdGeneratorTest.java at line 28.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free