Home / Class/ MulticastTestHandler Class — netty Architecture

MulticastTestHandler Class — netty Architecture

Architecture documentation for the MulticastTestHandler class in DatagramMulticastTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4f25bc18_1225_d70b_2f2c_4f944bdb2a38["MulticastTestHandler"]
  59f725b3_d71e_0340_9cb3_ab94afb3f68f["DatagramMulticastTest.java"]
  4f25bc18_1225_d70b_2f2c_4f944bdb2a38 -->|defined in| 59f725b3_d71e_0340_9cb3_ab94afb3f68f
  8a32ef02_7b7e_476b_5c51_b215afcd3d5b["channelRead0()"]
  4f25bc18_1225_d70b_2f2c_4f944bdb2a38 -->|method| 8a32ef02_7b7e_476b_5c51_b215afcd3d5b
  bae70344_8811_f0bd_5b7e_db8d2b64a12a["await()"]
  4f25bc18_1225_d70b_2f2c_4f944bdb2a38 -->|method| bae70344_8811_f0bd_5b7e_db8d2b64a12a

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java lines 161–190

    @ChannelHandler.Sharable
    private static final class MulticastTestHandler extends SimpleChannelInboundHandler<DatagramPacket> {
        private final CountDownLatch latch = new CountDownLatch(1);

        private boolean done;
        private volatile boolean fail;

        @Override
        protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
            if (done) {
                fail = true;
            }

            assertEquals(1, msg.content().readInt());

            latch.countDown();

            // mark the handler as done as we only are supposed to receive one message
            done = true;
        }

        public boolean await() throws Exception {
            boolean success = latch.await(10, TimeUnit.SECONDS);
            if (fail) {
                // fail if we receive an message after we are done
                fail();
            }
            return success;
        }
    }

Frequently Asked Questions

What is the MulticastTestHandler class?
MulticastTestHandler is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java.
Where is MulticastTestHandler defined?
MulticastTestHandler is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramMulticastTest.java at line 161.

Analyze Your Own Codebase

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

Try Supermodel Free