Home / Class/ NativeInetAddressTest Class — netty Architecture

NativeInetAddressTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  32eb789d_8701_8ffc_177a_69c16006f998["NativeInetAddressTest"]
  a8617a6d_a067_b55b_fa6e_7e628bd0399b["NativeInetAddressTest.java"]
  32eb789d_8701_8ffc_177a_69c16006f998 -->|defined in| a8617a6d_a067_b55b_fa6e_7e628bd0399b
  b428d339_3d7b_e456_cf77_baa7358c1ee0["testAddressNotIncludeScopeId()"]
  32eb789d_8701_8ffc_177a_69c16006f998 -->|method| b428d339_3d7b_e456_cf77_baa7358c1ee0
  aa96152b_6e1a_2088_4470_f761e1ebd82d["testLinkOnlyAddressIncludeScopeId()"]
  32eb789d_8701_8ffc_177a_69c16006f998 -->|method| aa96152b_6e1a_2088_4470_f761e1ebd82d

Relationship Graph

Source Code

transport-native-unix-common/src/test/java/io/netty/channel/unix/NativeInetAddressTest.java lines 26–56

public class NativeInetAddressTest {

    @Test
    public void testAddressNotIncludeScopeId() {
        int port = 80;
        ByteBuffer buffer = ByteBuffer.wrap(new byte[24]);
        buffer.put(new byte[] {'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1'});
        buffer.putInt(0);
        buffer.putInt(port);
        InetSocketAddress address = NativeInetAddress.address(buffer.array(), 0, buffer.capacity());
        assertEquals(port, address.getPort());
        assertInstanceOf(Inet6Address.class, address.getAddress());
        assertFalse(address.getAddress().isLinkLocalAddress());
        assertEquals("3030:3030:3030:3030:3030:3030:3030:3031", address.getAddress().getHostName());
    }

    @Test
    public void testLinkOnlyAddressIncludeScopeId() {
        int port = 80;
        ByteBuffer buffer = ByteBuffer.wrap(new byte[24]);
        buffer.put(new byte[] {
                (byte) 0xfe, (byte) (byte) 0x80, '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1'});
        buffer.putInt(0);
        buffer.putInt(port);
        InetSocketAddress address = NativeInetAddress.address(buffer.array(), 0, buffer.capacity());
        assertEquals(port, address.getPort());
        assertInstanceOf(Inet6Address.class, address.getAddress());
        assertTrue(address.getAddress().isLinkLocalAddress());
        assertEquals("fe80:3030:3030:3030:3030:3030:3030:3031%0", address.getAddress().getHostName());
    }
}

Frequently Asked Questions

What is the NativeInetAddressTest class?
NativeInetAddressTest is a class in the netty codebase, defined in transport-native-unix-common/src/test/java/io/netty/channel/unix/NativeInetAddressTest.java.
Where is NativeInetAddressTest defined?
NativeInetAddressTest is defined in transport-native-unix-common/src/test/java/io/netty/channel/unix/NativeInetAddressTest.java at line 26.

Analyze Your Own Codebase

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

Try Supermodel Free