public static int byteLength(Version version) {
        switch (version) {
        case INET:
            return INET_BYTE_LENGTH;
        case INET6:
            return INET6_BYTE_LENGTH;
        default:
            String msg = "Invalid IP version " + version;
            throw new IllegalArgumentException(msg);
        }
    }
@Test
    public void testAddrByteLength() {
        assertThat(IpAddress.INET_BYTE_LENGTH, is(4));
        assertThat(IpAddress.INET6_BYTE_LENGTH, is(16));
        assertThat(IpAddress.byteLength(IpAddress.Version.INET), is(4));
        assertThat(IpAddress.byteLength(IpAddress.Version.INET6), is(16));
    }