Home / Class/ DatagramConnectNotExistsTest Class — netty Architecture

DatagramConnectNotExistsTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  fb706699_5827_ae02_7172_b3943ac83713["DatagramConnectNotExistsTest"]
  7de2e575_2062_e997_d923_18569d30f36b["DatagramConnectNotExistsTest.java"]
  fb706699_5827_ae02_7172_b3943ac83713 -->|defined in| 7de2e575_2062_e997_d923_18569d30f36b
  56ce441c_02b4_56a5_d5ce_89794be75088["newFactories()"]
  fb706699_5827_ae02_7172_b3943ac83713 -->|method| 56ce441c_02b4_56a5_d5ce_89794be75088
  fc412769_92bc_0016_6a41_34b8a05515b1["testConnectNotExists()"]
  fb706699_5827_ae02_7172_b3943ac83713 -->|method| fc412769_92bc_0016_6a41_34b8a05515b1

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramConnectNotExistsTest.java lines 42–84

public class DatagramConnectNotExistsTest extends AbstractClientSocketTest {

    @Override
    protected List<TestsuitePermutation.BootstrapFactory<Bootstrap>> newFactories() {
        return SocketTestPermutation.INSTANCE.datagramSocket();
    }

    @Test
    @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
    public void testConnectNotExists(TestInfo testInfo) throws Throwable {
        run(testInfo, new Runner<Bootstrap>() {
            @Override
            public void run(Bootstrap bootstrap) {
                testConnectNotExists(bootstrap);
            }
        });
    }

    public void testConnectNotExists(Bootstrap cb) {
        // Currently not works on windows
        // See https://github.com/netty/netty/issues/11285
        assumeFalse(PlatformDependent.isWindows());
        final Promise<Throwable> promise = ImmediateEventExecutor.INSTANCE.newPromise();
        cb.handler(new ChannelInboundHandlerAdapter() {
            @Override
            public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
                promise.trySuccess(cause);
            }
        });
        ChannelFuture future = cb.connect(NetUtil.LOCALHOST, SocketTestPermutation.BAD_PORT);
        try {
            Channel datagramChannel = future.syncUninterruptibly().channel();
            assertTrue(datagramChannel.isActive());
            datagramChannel.writeAndFlush(
                    Unpooled.copiedBuffer("test", CharsetUtil.US_ASCII)).syncUninterruptibly();
            if (!(datagramChannel instanceof OioDatagramChannel)) {
                assertTrue(promise.syncUninterruptibly().getNow() instanceof PortUnreachableException);
            }
        } finally {
            future.channel().close();
        }
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free