jdk/test/java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java
author bpb
Tue, 23 Jun 2015 09:46:22 -0700
changeset 31252 b495f68ca12c
parent 29528 d1a052f7ccef
child 36004 91d5f006921d
permissions -rw-r--r--
8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows Summary: Suppress testing the Teredo tunneling interface on Windows. Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17198
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
     1
/*
31252
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
17198
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
     4
 *
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
     8
 *
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    13
 * accompanied this code).
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    14
 *
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    18
 *
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    21
 * questions.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    22
 */
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    23
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    24
import java.io.ByteArrayInputStream;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    25
import java.io.ByteArrayOutputStream;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    26
import java.io.FileNotFoundException;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    27
import java.io.FileOutputStream;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    28
import java.io.IOException;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    29
import java.io.ObjectInputStream;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    30
import java.io.ObjectOutputStream;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    31
import java.io.PrintStream;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    32
import java.net.Inet6Address;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    33
import java.net.InetAddress;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    34
import java.net.NetworkInterface;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    35
import java.net.UnknownHostException;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    36
import java.util.ArrayList;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    37
import java.util.Arrays;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    38
import java.util.Enumeration;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    39
import java.util.List;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    40
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    41
/**
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    42
 * @test
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    43
 * @bug 8007373
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    44
 * @summary jdk7 backward compatibility serialization problem
29528
d1a052f7ccef 8075565: Define @intermittent jtreg keyword and mark intermittently failing jdk tests
darcy
parents: 17198
diff changeset
    45
 * @key intermittent
17198
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    46
 */
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    47
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    48
public class Inet6AddressSerializationTest {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    49
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    50
    static boolean failed;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    51
31252
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
    52
    static boolean isWindows = System.getProperty("os.name").startsWith("Windows");
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
    53
17198
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    54
    public static final int LOOPBACK_SCOPE_ID = 0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    55
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    56
    public static final byte[] IN6ADDR_ANY_INIT = { (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    57
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    58
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    59
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    60
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    61
    public static final byte[] LOOPBACKIPV6ADDRESS = { (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    62
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    63
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    64
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    65
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    66
    // fe80::21b:24ff:febd:f29c
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    67
    public static final byte[] E1000G0IPV6ADDRESS = { (byte) 0xfe, (byte) 0x80,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    68
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    69
            (byte) 0x00, (byte) 0x02, (byte) 0x1b, (byte) 0x24, (byte) 0xff,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    70
            (byte) 0xfe, (byte) 0xbd, (byte) 0xf2, (byte) 0x9c };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    71
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    72
    public static final String E1000G0HOSTNAME = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    73
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    74
    public static final String LOCALHOSTNAME = "localhost";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    75
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    76
    public static final String NETWORK_IF_E1000G0 = "e1000g0";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    77
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    78
    public static final String NETWORK_IF_LO0 = "lo0";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    79
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    80
    public static final int SCOPE_ID_E1000G0 = 2;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    81
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    82
    public static final int SCOPE_ID_LO0 = 1;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    83
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    84
    public static final int SCOPE_ID_ZERO = 0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    85
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    86
    public static void main(String[] args) throws Exception {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    87
        // args[0] == generate-loopback generates serial data for loopback if
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    88
        // args[0] == generateAll generates serial data for interfaces with an
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    89
        // IPV6 address binding
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    90
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    91
        if (args.length != 0) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    92
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    93
            if (args[0].equals("generate-loopback")) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    94
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    95
                generateSerializedInet6AddressData(Inet6Address.getByAddress(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    96
                        InetAddress.getLoopbackAddress().getHostName(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    97
                        LOOPBACKIPV6ADDRESS, LOOPBACK_SCOPE_ID), System.out,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    98
                        true);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
    99
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   100
            } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   101
                generateAllInet6AddressSerializedData();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   102
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   103
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   104
            runTests();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   105
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   106
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   107
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   108
    private static void runTests() throws UnknownHostException, Exception,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   109
            IOException {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   110
        byte[] thisHostIPV6Address = null;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   111
        int scope_id = LOOPBACK_SCOPE_ID;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   112
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   113
        System.out.println("Hostname: "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   114
                + InetAddress.getLocalHost().getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   115
        System.out.println("LocalHost isLoopback : "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   116
                + InetAddress.getLocalHost().isLoopbackAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   117
        thisHostIPV6Address = getThisHostIPV6Address(InetAddress.getLocalHost()
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   118
                .getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   119
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   120
        if (thisHostIPV6Address == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   121
            thisHostIPV6Address = IN6ADDR_ANY_INIT;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   122
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   123
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   124
        // testing JDK7 generated serialized loopback against locally generated
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   125
        // loopback address
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   126
        testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   127
                .getLoopbackAddress().getHostName(), LOOPBACKIPV6ADDRESS,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   128
                scope_id), JDK7Inet6AddressSerialData);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   129
        // testing JDK8 generated serialized loopback against locally generated
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   130
        // loopback address
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   131
        testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   132
                .getLoopbackAddress().getHostName(), LOOPBACKIPV6ADDRESS,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   133
                scope_id), JDK8Inet6AddressSerialData);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   134
        testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   135
                .getLocalHost().getHostName(), IN6ADDR_ANY_INIT, scope_id),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   136
                null);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   137
        testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   138
                .getLocalHost().getHostName(), thisHostIPV6Address, scope_id),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   139
                null);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   140
        testAllNetworkInterfaces();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   141
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   142
        // test against lo0
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   143
        testSerializedLo0Inet6Address();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   144
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   145
        testSerializedE1000gInet6Address();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   146
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   147
        if (failed)
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   148
            throw new RuntimeException("Some tests failed, check output");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   149
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   150
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   151
    private static byte[] getThisHostIPV6Address(String hostName)
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   152
            throws Exception {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   153
        InetAddress[] thisHostIPAddresses = null;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   154
        try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   155
            thisHostIPAddresses = InetAddress.getAllByName(InetAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   156
                    .getLocalHost().getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   157
        } catch (UnknownHostException uhEx) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   158
            uhEx.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   159
            throw uhEx;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   160
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   161
        byte[] thisHostIPV6Address = null;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   162
        for (InetAddress inetAddress : thisHostIPAddresses) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   163
            if (inetAddress instanceof Inet6Address) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   164
                if (inetAddress.getHostName().equals(hostName)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   165
                    thisHostIPV6Address = inetAddress.getAddress();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   166
                    break;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   167
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   168
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   169
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   170
        // System.err.println("getThisHostIPV6Address: address is "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   171
        // + Arrays.toString(thisHostIPV6Address));
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   172
        return thisHostIPV6Address;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   173
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   174
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   175
    static void testAllNetworkInterfaces() throws Exception {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   176
        System.err.println("\n testAllNetworkInterfaces: \n ");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   177
        for (Enumeration<NetworkInterface> e = NetworkInterface
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   178
                .getNetworkInterfaces(); e.hasMoreElements();) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   179
            NetworkInterface netIF = e.nextElement();
31252
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
   180
            // Skip (Windows)Teredo Tunneling Pseudo-Interface
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
   181
            if (isWindows) {
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
   182
                String dName = netIF.getDisplayName();
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
   183
                if (dName != null && dName.contains("Teredo")) {
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
   184
                    continue;
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
   185
                }
b495f68ca12c 8129510: java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java should exclude testing the Teredo tunneling interface on Windows
bpb
parents: 29528
diff changeset
   186
            }
17198
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   187
            for (Enumeration<InetAddress> iadrs = netIF.getInetAddresses(); iadrs
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   188
                    .hasMoreElements();) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   189
                InetAddress iadr = iadrs.nextElement();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   190
                if (iadr instanceof Inet6Address) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   191
                    System.err.println("Test NetworkInterface:  " + netIF);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   192
                    Inet6Address i6adr = (Inet6Address) iadr;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   193
                    System.err.println("Testing with " + iadr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   194
                    System.err.println(" scoped iface: "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   195
                            + i6adr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   196
                    testInet6AddressSerialization(i6adr, null);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   197
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   198
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   199
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   200
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   201
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   202
    static void displayExpectedInet6Address(Inet6Address expectedInet6Address) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   203
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   204
        String expectedHostName = expectedInet6Address.getHostName();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   205
        byte[] expectedAddress = expectedInet6Address.getAddress();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   206
        String expectedHostAddress = expectedInet6Address.getHostAddress();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   207
        int expectedScopeId = expectedInet6Address.getScopeId();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   208
        NetworkInterface expectedNetIf = expectedInet6Address
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   209
                .getScopedInterface();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   210
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   211
        System.err.println("Excpected HostName: " + expectedHostName);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   212
        System.err.println("Expected Address: "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   213
                + Arrays.toString(expectedAddress));
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   214
        System.err.println("Expected HostAddress: " + expectedHostAddress);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   215
        System.err.println("Expected Scope Id " + expectedScopeId);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   216
        System.err.println("Expected NetworkInterface " + expectedNetIf);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   217
        System.err.println("Expected Inet6Address " + expectedInet6Address);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   218
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   219
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   220
    // test serialization deserialization of Inet6Address
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   221
    static void testInet6AddressSerialization(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   222
            Inet6Address expectedInet6Address, byte[] serializedAddress)
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   223
            throws IOException {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   224
        System.err.println("\n testInet6AddressSerialization:  enter \n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   225
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   226
        // displayExpectedInet6Address(expectedInet6Address);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   227
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   228
        byte[] serialData = serializedAddress != null ? serializedAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   229
                : generateSerializedInet6AddressData(expectedInet6Address,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   230
                        null, false);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   231
        try (ByteArrayInputStream bis = new ByteArrayInputStream(serialData);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   232
                ObjectInputStream oin = new ObjectInputStream(bis)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   233
            Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   234
            System.err.println("Deserialized Inet6Address "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   235
                    + deserializedIPV6Addr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   236
            assertHostNameEqual(expectedInet6Address.getHostName(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   237
                    deserializedIPV6Addr.getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   238
            assertHostAddressEqual(expectedInet6Address.getHostAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   239
                    deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   240
            assertAddressEqual(expectedInet6Address.getAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   241
                    deserializedIPV6Addr.getAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   242
            assertScopeIdEqual(expectedInet6Address.getScopeId(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   243
                    deserializedIPV6Addr.getScopeId());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   244
            assertNetworkInterfaceEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   245
                    expectedInet6Address.getScopedInterface(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   246
                    deserializedIPV6Addr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   247
        } catch (Exception e) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   248
            System.err.println("Exception caught during deserialization");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   249
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   250
            e.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   251
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   252
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   253
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   254
    static void testSerializedE1000gInet6Address() throws IOException {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   255
        System.err.println("\n testSerializedE1000gInet6Address:  enter \n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   256
        boolean testWithNetIf = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   257
        boolean useMockInet6Address = false;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   258
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   259
        NetworkInterface testNetIf = NetworkInterface
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   260
                .getByName(NETWORK_IF_E1000G0);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   261
        Inet6Address expectedInet6Address = null;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   262
        if (testNetIf != null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   263
            System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   264
                    .println("\n testSerializedE1000gInet6Address:  using netif \n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   265
            try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   266
                expectedInet6Address = Inet6Address.getByAddress(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   267
                        E1000G0HOSTNAME, E1000G0IPV6ADDRESS, testNetIf);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   268
            } catch (UnknownHostException ukhEx) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   269
                ukhEx.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   270
                testWithNetIf = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   271
                useMockInet6Address = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   272
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   273
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   274
            System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   275
                    .println("\n testSerializedE1000gInet6Address:  using index \n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   276
            try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   277
                expectedInet6Address = Inet6Address.getByAddress(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   278
                        E1000G0HOSTNAME, E1000G0IPV6ADDRESS, SCOPE_ID_ZERO);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   279
            } catch (UnknownHostException ukhEx1) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   280
                ukhEx1.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   281
                useMockInet6Address = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   282
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   283
            testWithNetIf = false;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   284
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   285
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   286
        byte[] serializedAddress = SerialData_ifname_e1000g0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   287
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   288
        // displayExpectedInet6Address(expectedInet6Address);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   289
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   290
        try (ByteArrayInputStream bis = new ByteArrayInputStream(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   291
                serializedAddress);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   292
                ObjectInputStream oin = new ObjectInputStream(bis)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   293
            Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   294
            System.err.println("Deserialized Inet6Address "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   295
                    + deserializedIPV6Addr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   296
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   297
            if (!useMockInet6Address) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   298
                assertHostNameEqual(expectedInet6Address.getHostName(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   299
                        deserializedIPV6Addr.getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   300
                if (testWithNetIf) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   301
                    assertHostAddressEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   302
                            expectedInet6Address.getHostAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   303
                            deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   304
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   305
                    assertHostAddressEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   306
                            MockE1000g0Inet6Address.getBareHostAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   307
                            deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   308
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   309
                assertAddressEqual(expectedInet6Address.getAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   310
                        deserializedIPV6Addr.getAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   311
                assertScopeIdEqual(expectedInet6Address.getScopeId(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   312
                        deserializedIPV6Addr.getScopeId());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   313
                if (testWithNetIf) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   314
                    assertNetworkInterfaceEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   315
                            expectedInet6Address.getScopedInterface(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   316
                            deserializedIPV6Addr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   317
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   318
                    assertNetworkInterfaceEqual(null,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   319
                            deserializedIPV6Addr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   320
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   321
            } else { // use MockLo0Inet6Address
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   322
                assertHostNameEqual(MockE1000g0Inet6Address.getHostName(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   323
                        deserializedIPV6Addr.getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   324
                if (testWithNetIf) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   325
                    assertHostAddressEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   326
                            MockE1000g0Inet6Address.getHostAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   327
                            deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   328
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   329
                    assertHostAddressEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   330
                            MockE1000g0Inet6Address.getHostAddressWithIndex(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   331
                            deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   332
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   333
                assertAddressEqual(MockE1000g0Inet6Address.getAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   334
                        deserializedIPV6Addr.getAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   335
                if (testWithNetIf) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   336
                assertScopeIdEqual(MockE1000g0Inet6Address.getScopeId(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   337
                        deserializedIPV6Addr.getScopeId());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   338
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   339
                    assertScopeIdEqual(MockE1000g0Inet6Address.getScopeZero(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   340
                            deserializedIPV6Addr.getScopeId());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   341
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   342
                assertNetworkInterfaceNameEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   343
                        MockE1000g0Inet6Address.getScopeIfName(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   344
                        deserializedIPV6Addr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   345
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   346
        } catch (Exception e) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   347
            System.err.println("Exception caught during deserialization");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   348
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   349
            e.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   350
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   351
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   352
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   353
    static void testSerializedLo0Inet6Address() throws IOException {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   354
        System.err.println("\n testSerializedLo0Inet6Address:  enter \n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   355
        boolean testWithNetIf = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   356
        boolean useMockInet6Address = false;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   357
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   358
        NetworkInterface testNetIf = NetworkInterface.getByName(NETWORK_IF_LO0);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   359
        Inet6Address expectedInet6Address = null;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   360
        if (testNetIf != null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   361
            System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   362
                    .println("\n testSerializedLo0Inet6Address:  using netif \n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   363
            try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   364
                expectedInet6Address = Inet6Address.getByAddress(LOCALHOSTNAME,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   365
                        LOOPBACKIPV6ADDRESS, testNetIf);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   366
            } catch (UnknownHostException ukhEx) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   367
                ukhEx.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   368
                testWithNetIf = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   369
                useMockInet6Address = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   370
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   371
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   372
            System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   373
                    .println("\n testSerializedLo0Inet6Address:  using index \n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   374
            try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   375
                expectedInet6Address = Inet6Address.getByAddress(LOCALHOSTNAME,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   376
                        LOOPBACKIPV6ADDRESS, SCOPE_ID_ZERO);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   377
            } catch (UnknownHostException ukhEx1) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   378
                ukhEx1.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   379
                useMockInet6Address = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   380
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   381
            testWithNetIf = false;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   382
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   383
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   384
        // displayExpectedInet6Address(expectedInet6Address);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   385
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   386
        byte[] serializedAddress = SerialData_ifname_lo0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   387
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   388
        try (ByteArrayInputStream bis = new ByteArrayInputStream(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   389
                serializedAddress);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   390
                ObjectInputStream oin = new ObjectInputStream(bis)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   391
            Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   392
            System.err.println("Deserialized Inet6Address "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   393
                    + deserializedIPV6Addr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   394
            if (!useMockInet6Address) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   395
                assertHostNameEqual(expectedInet6Address.getHostName(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   396
                        deserializedIPV6Addr.getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   397
                if (testWithNetIf) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   398
                    assertHostAddressEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   399
                            expectedInet6Address.getHostAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   400
                            deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   401
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   402
                    assertHostAddressEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   403
                            MockLo0Inet6Address.getBareHostAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   404
                            deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   405
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   406
                assertAddressEqual(expectedInet6Address.getAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   407
                        deserializedIPV6Addr.getAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   408
                assertScopeIdEqual(expectedInet6Address.getScopeId(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   409
                        deserializedIPV6Addr.getScopeId());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   410
                if (testWithNetIf) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   411
                    assertNetworkInterfaceEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   412
                            expectedInet6Address.getScopedInterface(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   413
                            deserializedIPV6Addr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   414
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   415
                    assertNetworkInterfaceEqual(null,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   416
                            deserializedIPV6Addr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   417
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   418
            } else { // use MockLo0Inet6Address
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   419
                assertHostNameEqual(MockLo0Inet6Address.getHostName(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   420
                        deserializedIPV6Addr.getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   421
                if (testWithNetIf) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   422
                    assertHostAddressEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   423
                            MockLo0Inet6Address.getHostAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   424
                            deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   425
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   426
                    assertHostAddressEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   427
                            MockLo0Inet6Address.getHostAddressWithIndex(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   428
                            deserializedIPV6Addr.getHostAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   429
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   430
                assertAddressEqual(MockLo0Inet6Address.getAddress(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   431
                        deserializedIPV6Addr.getAddress());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   432
                if (testWithNetIf) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   433
                assertScopeIdEqual(MockLo0Inet6Address.getScopeId(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   434
                        deserializedIPV6Addr.getScopeId());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   435
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   436
                    assertScopeIdEqual(MockLo0Inet6Address.getScopeZero(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   437
                            deserializedIPV6Addr.getScopeId());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   438
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   439
                assertNetworkInterfaceNameEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   440
                        MockLo0Inet6Address.getScopeIfName(),
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   441
                        deserializedIPV6Addr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   442
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   443
        } catch (Exception e) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   444
            System.err.println("Exception caught during deserialization");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   445
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   446
            e.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   447
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   448
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   449
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   450
    static List<Inet6Address> getAllInet6Addresses() throws Exception {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   451
        // System.err.println("\n getAllInet6Addresses: \n ");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   452
        ArrayList<Inet6Address> inet6Addresses = new ArrayList<Inet6Address>();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   453
        for (Enumeration<NetworkInterface> e = NetworkInterface
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   454
                .getNetworkInterfaces(); e.hasMoreElements();) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   455
            NetworkInterface netIF = e.nextElement();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   456
            for (Enumeration<InetAddress> iadrs = netIF.getInetAddresses(); iadrs
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   457
                    .hasMoreElements();) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   458
                InetAddress iadr = iadrs.nextElement();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   459
                if (iadr instanceof Inet6Address) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   460
                    System.err.println("Test NetworkInterface:  " + netIF);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   461
                    Inet6Address i6adr = (Inet6Address) iadr;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   462
                    System.err.println(" address " + iadr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   463
                    System.err.println(" scoped iface: "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   464
                            + i6adr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   465
                    // using this to actually set the hostName for an
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   466
                    // InetAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   467
                    // created through the NetworkInterface
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   468
                    // have found that the fabricated instances has a null
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   469
                    // hostName
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   470
                    System.err.println(" hostName: " + i6adr.getHostName());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   471
                    inet6Addresses.add(i6adr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   472
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   473
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   474
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   475
        return inet6Addresses;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   476
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   477
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   478
    static void assertHostNameEqual(String expectedHostName,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   479
            String deserializedHostName) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   480
        System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   481
                .println("Inet6AddressSerializationTest.assertHostNameEqual:");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   482
        if (expectedHostName == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   483
            if (deserializedHostName == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   484
                // ok, do nothing.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   485
            } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   486
                System.err.println("Error checking " + " HostName, expected:"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   487
                        + expectedHostName + ", got :" + deserializedHostName);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   488
                failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   489
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   490
        } else if (!expectedHostName.equals(deserializedHostName)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   491
            System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   492
                    + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   493
                    " HostName, expected:" + expectedHostName + ", got :"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   494
                    + deserializedHostName);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   495
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   496
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   497
            System.err.println("HostName equality "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   498
                    + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   499
                    " HostName, expected:" + expectedHostName + ", got :"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   500
                    + deserializedHostName);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   501
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   502
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   503
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   504
    static void assertHostAddressEqual(String expectedHostAddress,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   505
            String deserializedHostAddress) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   506
        System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   507
                .println("Inet6AddressSerializationTest.assertHostAddressEqual:");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   508
        if (expectedHostAddress == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   509
            if (deserializedHostAddress == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   510
                // ok, do nothing.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   511
            } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   512
                System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   513
                        + " HostAddress, expected: " + expectedHostAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   514
                        + ", got: " + deserializedHostAddress);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   515
                failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   516
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   517
        } else if (!expectedHostAddress.equals(deserializedHostAddress)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   518
            System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   519
                    + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   520
                    " HostAddress, expected: " + expectedHostAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   521
                    + ", got: " + deserializedHostAddress);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   522
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   523
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   524
            System.err.println("HostAddress equality "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   525
                    + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   526
                    " HostAddress, expected: " + expectedHostAddress
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   527
                    + ", got: " + deserializedHostAddress);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   528
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   529
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   530
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   531
    static void assertAddressEqual(byte[] expectedAddress,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   532
            byte[] deserializedAddress) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   533
        System.err.println("Inet6AddressSerializationTest.assertAddressEqual:");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   534
        if (expectedAddress == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   535
            if (deserializedAddress == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   536
                // ok, do nothing.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   537
            } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   538
                System.err.println("Error checking " + " Address, expected:"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   539
                        + Arrays.toString(expectedAddress) + ", got: "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   540
                        + Arrays.toString(deserializedAddress));
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   541
                failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   542
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   543
        } else if (!Arrays.equals(expectedAddress, deserializedAddress)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   544
            System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   545
                    + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   546
                    " Address, expected: " + Arrays.toString(expectedAddress)
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   547
                    + ", got: " + Arrays.toString(deserializedAddress));
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   548
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   549
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   550
            System.err.println("Address equality "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   551
                    + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   552
                    " Address, expected: " + Arrays.toString(expectedAddress)
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   553
                    + ", got: " + Arrays.toString(deserializedAddress));
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   554
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   555
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   556
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   557
    static void assertScopeIdEqual(int expectedScopeId, int deserializedScopeId) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   558
        System.err.println("Inet6AddressSerializationTest.assertScopeIdEqual:");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   559
        if (expectedScopeId != deserializedScopeId) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   560
            System.err.println("Error checking " + " ScopeId, expected:"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   561
                    + expectedScopeId + ", got: " + deserializedScopeId);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   562
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   563
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   564
            System.err.println("ScopeId equality "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   565
                    + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   566
                    " ScopeId, expected: " + expectedScopeId + ", got: "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   567
                    + deserializedScopeId);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   568
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   569
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   570
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   571
    static void assertNetworkInterfaceNameEqual(String expectedNetworkIfName,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   572
            NetworkInterface deserializedNetworkInterface) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   573
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   574
        if (deserializedNetworkInterface != null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   575
            String deserializedNetworkIfName = deserializedNetworkInterface
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   576
                    .getName();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   577
            System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   578
                    .println("Inet6AddressSerializationTest.assertHostNameEqual:");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   579
            if (expectedNetworkIfName == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   580
                if (deserializedNetworkIfName == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   581
                    // ok, do nothing.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   582
                } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   583
                    System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   584
                            + " NetworkIfName, expected: "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   585
                            + expectedNetworkIfName + ", got: "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   586
                            + deserializedNetworkIfName);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   587
                    failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   588
                }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   589
            } else if (!expectedNetworkIfName.equals(deserializedNetworkIfName)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   590
                System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   591
                        + " NetworkIfName, expected: " + expectedNetworkIfName
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   592
                        + ", got: " + deserializedNetworkIfName);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   593
                failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   594
            } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   595
                System.err.println("NetworkIfName equality "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   596
                        + " NetworkIfName, expected: " + expectedNetworkIfName
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   597
                        + ", got: " + deserializedNetworkIfName);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   598
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   599
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   600
            System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   601
                    .println("Warning "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   602
                            + " NetworkInterface  expected, but is null - ifname not relevant on deserializing host");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   603
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   604
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   605
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   606
    static void assertNetworkInterfaceEqual(
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   607
            NetworkInterface expectedNetworkInterface,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   608
            NetworkInterface deserializedNetworkInterface) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   609
        System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   610
                .println("Inet6AddressSerializationTest.assertNetworkInterfaceEqual:");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   611
        if (expectedNetworkInterface == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   612
            if (deserializedNetworkInterface == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   613
                // ok, do nothing.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   614
                System.err.println("Network Interface equality "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   615
                        + " NetworkInterface, expected:"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   616
                        + expectedNetworkInterface + ", got :"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   617
                        + deserializedNetworkInterface);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   618
            } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   619
                System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   620
                        + " NetworkInterface, expected:"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   621
                        + expectedNetworkInterface + ", got :"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   622
                        + deserializedNetworkInterface);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   623
                failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   624
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   625
        } else if (!expectedNetworkInterface
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   626
                .equals(deserializedNetworkInterface)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   627
            System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   628
                    + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   629
                    " NetworkInterface, expected:" + expectedNetworkInterface
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   630
                    + ", got :" + deserializedNetworkInterface);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   631
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   632
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   633
            System.err.println("Network Interface equality "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   634
                    + " NetworkInterface, expected:" + expectedNetworkInterface
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   635
                    + ", got :" + deserializedNetworkInterface);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   636
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   637
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   638
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   639
    static void equal(Object expected, Object got) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   640
        if (expected == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   641
            if (got == null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   642
                // ok, do nothing.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   643
            } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   644
                System.err.println("Error checking "
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   645
                        + " serial data, expected:" + expected + ", got :"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   646
                        + got);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   647
                failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   648
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   649
        } else if (!expected.equals(got)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   650
            System.err.println("Error checking " + // versionStr +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   651
                    " serial data, expected:" + expected + ", got :" + got);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   652
            failed = true;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   653
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   654
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   655
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   656
    // Used to generate serialData.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   657
    static byte[] generateSerializedInet6AddressData(Inet6Address addr,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   658
            PrintStream out, boolean outputToFile) throws IOException {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   659
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   660
        try (ObjectOutputStream oos = new ObjectOutputStream(bos)) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   661
            oos.writeObject(addr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   662
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   663
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   664
        String ifname = getIfName(addr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   665
        byte[] ba = bos.toByteArray();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   666
        if (out != null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   667
            out.format("static final byte[] SerialData" + ifname + " = {\n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   668
            for (int i = 0; i < ba.length; i++) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   669
                out.format(" (byte)0x%02X", ba[i]);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   670
                if (i != (ba.length - 1))
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   671
                    out.format(",");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   672
                if (((i + 1) % 6) == 0)
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   673
                    out.format("\n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   674
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   675
            out.format(" };\n \n");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   676
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   677
        if (outputToFile) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   678
            serializeInet6AddressToFile(addr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   679
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   680
        return ba;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   681
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   682
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   683
    private static String getIfName(Inet6Address inet6Addr) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   684
        String ifname;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   685
        if (inet6Addr.getScopedInterface() != null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   686
            ifname = "_ifname_" + inet6Addr.getScopedInterface().getName();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   687
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   688
            ifname = "_ifname_"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   689
                    + Integer.valueOf(inet6Addr.getScopeId()).toString();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   690
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   691
        return ifname;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   692
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   693
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   694
    static void generateAllInet6AddressSerializedData() throws IOException {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   695
        // System.err.println("generateAllInet6AddressSerializedData: enter ....");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   696
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   697
        List<Inet6Address> inet6Addresses;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   698
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   699
        try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   700
            inet6Addresses = getAllInet6Addresses();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   701
        } catch (Exception e) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   702
            e.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   703
            throw new IOException(e);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   704
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   705
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   706
        for (Inet6Address inet6Address : inet6Addresses) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   707
            generateSerializedInet6AddressData(inet6Address, System.out, true);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   708
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   709
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   710
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   711
    static void serializeInet6AddressToFile(Inet6Address inet6Addr) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   712
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   713
        // System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   714
        // .println("serializeInet6AddressToIPV6AddressFile: enter ....");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   715
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   716
        FileOutputStream fOut = null;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   717
        String inet6AddressOutputFilename = null;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   718
        inet6AddressOutputFilename = createOutputFileName(inet6Addr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   719
        try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   720
            fOut = new FileOutputStream(inet6AddressOutputFilename);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   721
        } catch (FileNotFoundException fnfEx) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   722
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   723
            fnfEx.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   724
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   725
        ObjectOutputStream ooStream = null;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   726
        try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   727
            if (fOut != null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   728
                ooStream = new ObjectOutputStream(fOut);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   729
            } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   730
                System.err.println("Problem initilising Object output stream ");
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   731
                System.exit(-1);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   732
            }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   733
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   734
        } catch (IOException e) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   735
            e.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   736
            System.exit(-1);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   737
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   738
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   739
        // serialise the last Inet6Address
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   740
        /*
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   741
         * System.err
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   742
         * .println("serializeInet6AddressToIPV6AddressFile scoped iface:  \n" +
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   743
         * inet6Addr.getScopedInterface());
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   744
         */
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   745
        try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   746
            ooStream.writeObject(inet6Addr);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   747
        } catch (Exception ex) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   748
            ex.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   749
            System.exit(-1);
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   750
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   751
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   752
        try {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   753
            ooStream.close();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   754
        } catch (IOException e) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   755
            e.printStackTrace();
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   756
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   757
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   758
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   759
    private static String createOutputFileName(Inet6Address inet6Addr) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   760
        String inet6AddressOutputFilename;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   761
        if (inet6Addr.getScopedInterface() != null) {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   762
            inet6AddressOutputFilename = "IPV6Address_"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   763
                    + inet6Addr.getScopedInterface().getName() + ".out";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   764
        } else {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   765
            inet6AddressOutputFilename = "IPV6Address_"
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   766
                    + Integer.valueOf(inet6Addr.getScopeId()).toString()
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   767
                    + ".out";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   768
        }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   769
        return inet6AddressOutputFilename;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   770
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   771
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   772
    // --- Generated data ---
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   773
    // JDK7 output java Inet6AddressSerializationTest generate.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   774
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   775
    // loopback lo0 interface on Solaris 10
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   776
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   777
    static final byte[] JDK7Inet6AddressSerialData = { (byte) 0xAC,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   778
            (byte) 0xED, (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   779
            (byte) 0x00, (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   780
            (byte) 0x61, (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   781
            (byte) 0x2E, (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   782
            (byte) 0x36, (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   783
            (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   784
            (byte) 0x20, (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   785
            (byte) 0x21, (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   786
            (byte) 0x00, (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   787
            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   788
            (byte) 0x5A, (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   789
            (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   790
            (byte) 0x64, (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   791
            (byte) 0x5A, (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   792
            (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   793
            (byte) 0x66, (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   794
            (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   795
            (byte) 0x00, (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   796
            (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   797
            (byte) 0x12, (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   798
            (byte) 0x61, (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   799
            (byte) 0x67, (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   800
            (byte) 0x69, (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   801
            (byte) 0x00, (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   802
            (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   803
            (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   804
            (byte) 0x42, (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   805
            (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   806
            (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   807
            (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   808
            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   809
            (byte) 0x2D, (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   810
            (byte) 0xE3, (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   811
            (byte) 0x03, (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   812
            (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   813
            (byte) 0x73, (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   814
            (byte) 0x61, (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   815
            (byte) 0x4C, (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   816
            (byte) 0x73, (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   817
            (byte) 0x65, (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   818
            (byte) 0x01, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   819
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   820
            (byte) 0x02, (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   821
            (byte) 0x6F, (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   822
            (byte) 0x6F, (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   823
            (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x70,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   824
            (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   825
            (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   826
            (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   827
            (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   828
            (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   829
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   830
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   831
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   832
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   833
    // JDK8 output java Inet6AddressSerializationTest generate.
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   834
    // loopback lo0 interface on Solaris 10
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   835
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   836
    static final byte[] JDK8Inet6AddressSerialData = { (byte) 0xAC,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   837
            (byte) 0xED, (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   838
            (byte) 0x00, (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   839
            (byte) 0x61, (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   840
            (byte) 0x2E, (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   841
            (byte) 0x36, (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   842
            (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   843
            (byte) 0x20, (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   844
            (byte) 0x21, (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   845
            (byte) 0x00, (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   846
            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   847
            (byte) 0x5A, (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   848
            (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   849
            (byte) 0x64, (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   850
            (byte) 0x5A, (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   851
            (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   852
            (byte) 0x66, (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   853
            (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   854
            (byte) 0x00, (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   855
            (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   856
            (byte) 0x12, (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   857
            (byte) 0x61, (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   858
            (byte) 0x67, (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   859
            (byte) 0x69, (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   860
            (byte) 0x00, (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   861
            (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   862
            (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   863
            (byte) 0x42, (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   864
            (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   865
            (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   866
            (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   867
            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   868
            (byte) 0x2D, (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   869
            (byte) 0xE3, (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   870
            (byte) 0x03, (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   871
            (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   872
            (byte) 0x73, (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   873
            (byte) 0x61, (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   874
            (byte) 0x4C, (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   875
            (byte) 0x73, (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   876
            (byte) 0x65, (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   877
            (byte) 0x01, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   878
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   879
            (byte) 0x02, (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   880
            (byte) 0x6F, (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   881
            (byte) 0x6F, (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   882
            (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x70,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   883
            (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   884
            (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   885
            (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   886
            (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   887
            (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   888
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   889
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   890
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   891
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   892
    // java Inet6AddressSerializationTest generateAll produces this inet6address
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   893
    // serial data
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   894
    // jdk8 generated serialization of on address fe80:0:0:0:21b:24ff:febd:f29c
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   895
    // net if e1000g0
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   896
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   897
    static final byte[] SerialData_ifname_e1000g0 = { (byte) 0xAC, (byte) 0xED,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   898
            (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   899
            (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   900
            (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   901
            (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x36,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   902
            (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   903
            (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C, (byte) 0x20,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   904
            (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80, (byte) 0x21,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   905
            (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   906
            (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F, (byte) 0x70,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   907
            (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64, (byte) 0x5A,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   908
            (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   909
            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   910
            (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x5A,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   911
            (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   912
            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x66,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   913
            (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x5F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   914
            (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   915
            (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   916
            (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00, (byte) 0x12,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   917
            (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   918
            (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E, (byte) 0x67,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   919
            (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72, (byte) 0x69,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   920
            (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   921
            (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   922
            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   923
            (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   924
            (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14, (byte) 0x6A,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   925
            (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E, (byte) 0x6E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   926
            (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49, (byte) 0x6E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   927
            (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   928
            (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x2D,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   929
            (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F, (byte) 0xE3,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   930
            (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00, (byte) 0x03,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   931
            (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   932
            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   933
            (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   934
            (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79, (byte) 0x4C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   935
            (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   936
            (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   937
            (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00, (byte) 0x01,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   938
            (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   939
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   940
            (byte) 0x74, (byte) 0x00, (byte) 0x25, (byte) 0x66, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   941
            (byte) 0x38, (byte) 0x30, (byte) 0x3A, (byte) 0x30, (byte) 0x3A,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   942
            (byte) 0x30, (byte) 0x3A, (byte) 0x30, (byte) 0x3A, (byte) 0x32,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   943
            (byte) 0x31, (byte) 0x62, (byte) 0x3A, (byte) 0x32, (byte) 0x34,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   944
            (byte) 0x66, (byte) 0x66, (byte) 0x3A, (byte) 0x66, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   945
            (byte) 0x62, (byte) 0x64, (byte) 0x3A, (byte) 0x66, (byte) 0x32,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   946
            (byte) 0x39, (byte) 0x63, (byte) 0x25, (byte) 0x65, (byte) 0x31,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   947
            (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x67, (byte) 0x30,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   948
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x01,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   949
            (byte) 0x01, (byte) 0x74, (byte) 0x00, (byte) 0x07, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   950
            (byte) 0x31, (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x67,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   951
            (byte) 0x30, (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   952
            (byte) 0x5B, (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   953
            (byte) 0xF8, (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   954
            (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   955
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0xFE,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   956
            (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   957
            (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x1B, (byte) 0x24,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   958
            (byte) 0xFF, (byte) 0xFE, (byte) 0xBD, (byte) 0xF2, (byte) 0x9C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   959
            (byte) 0x78 };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   960
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   961
    // jdk8 generated serialization of address 0::1 on net if lo0 hostname
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   962
    // localhost scope_id 1
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   963
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   964
    static final byte[] SerialData_ifname_lo0 = { (byte) 0xAC, (byte) 0xED,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   965
            (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   966
            (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   967
            (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   968
            (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x36,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   969
            (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   970
            (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C, (byte) 0x20,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   971
            (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80, (byte) 0x21,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   972
            (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   973
            (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F, (byte) 0x70,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   974
            (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64, (byte) 0x5A,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   975
            (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   976
            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   977
            (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x5A,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   978
            (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   979
            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x66,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   980
            (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x5F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   981
            (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   982
            (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   983
            (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00, (byte) 0x12,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   984
            (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   985
            (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E, (byte) 0x67,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   986
            (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72, (byte) 0x69,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   987
            (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   988
            (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   989
            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   990
            (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   991
            (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14, (byte) 0x6A,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   992
            (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E, (byte) 0x6E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   993
            (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49, (byte) 0x6E,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   994
            (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   995
            (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x2D,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   996
            (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F, (byte) 0xE3,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   997
            (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00, (byte) 0x03,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   998
            (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61, (byte) 0x64,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
   999
            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1000
            (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66, (byte) 0x61,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1001
            (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79, (byte) 0x4C,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1002
            (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F, (byte) 0x73,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1003
            (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1004
            (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00, (byte) 0x01,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1005
            (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1006
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1007
            (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1008
            (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68, (byte) 0x6F,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1009
            (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1010
            (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x74, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1011
            (byte) 0x03, (byte) 0x6C, (byte) 0x6F, (byte) 0x30, (byte) 0x75,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1012
            (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1013
            (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8, (byte) 0x06,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1014
            (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1015
            (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1016
            (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1017
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1018
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1019
            (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1020
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1021
}
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1022
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1023
class MockLo0Inet6Address {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1024
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1025
    private static final byte[] LOOPBACKIPV6ADDRESS = { (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1026
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1027
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1028
            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1029
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1030
    private static final String LOCALHOSTNAME = "localhost";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1031
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1032
    private static final String LO0HOSTADDRESS = "0:0:0:0:0:0:0:1%lo0";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1033
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1034
    private static final String BARE_LO0HOSTADDRESS = "0:0:0:0:0:0:0:1";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1035
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1036
    private static final String LO0HOSTADDRESS_WITHINDEX = "0:0:0:0:0:0:0:1%1";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1037
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1038
    private static final int SCOPE_ID_LO0 = 1;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1039
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1040
    private static final int SCOPE_ID_ZERO = 0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1041
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1042
    public static final String NETWORK_IF_LO0 = "lo0";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1043
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1044
    static String getHostName() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1045
        return LOCALHOSTNAME;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1046
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1047
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1048
    static String getHostAddress() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1049
        return LO0HOSTADDRESS;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1050
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1051
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1052
    static String getBareHostAddress() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1053
        return BARE_LO0HOSTADDRESS;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1054
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1055
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1056
    static String getHostAddressWithIndex() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1057
        return LO0HOSTADDRESS_WITHINDEX;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1058
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1059
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1060
    static byte[] getAddress() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1061
        return LOOPBACKIPV6ADDRESS;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1062
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1063
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1064
    static int getScopeId() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1065
        return SCOPE_ID_LO0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1066
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1067
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1068
    static int getScopeZero() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1069
        return SCOPE_ID_ZERO;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1070
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1071
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1072
    static String getScopeIfName() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1073
        return NETWORK_IF_LO0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1074
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1075
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1076
}
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1077
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1078
class MockE1000g0Inet6Address {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1079
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1080
    // fe80::21b:24ff:febd:f29c
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1081
    private static final byte[] E1000G0IPV6ADDRESS = { (byte) 0xfe,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1082
            (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1083
            (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x1b, (byte) 0x24,
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1084
            (byte) 0xff, (byte) 0xfe, (byte) 0xbd, (byte) 0xf2, (byte) 0x9c };
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1085
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1086
    private static final String E1000G0HOSTNAME = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1087
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1088
    private static final String BARE_E1000G0HOSTADDRESS = "fe80:0:0:0:21b:24ff:febd:f29c";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1089
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1090
    private static final String E1000G0HOSTADDRESS_WITHINDEX = "fe80:0:0:0:21b:24ff:febd:f29c%2";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1091
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1092
    private static final String E1000G0HOSTADDRESS = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1093
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1094
    private static final String NETWORK_IF_E1000G0 = "e1000g0";
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1095
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1096
    private static final int SCOPE_ID_E1000G0 = 2;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1097
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1098
    private static final int SCOPE_ID_ZERO = 0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1099
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1100
    static String getHostName() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1101
        return E1000G0HOSTNAME;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1102
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1103
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1104
    static String getHostAddress() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1105
        return E1000G0HOSTADDRESS;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1106
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1107
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1108
    static String getHostAddressWithIndex() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1109
        return E1000G0HOSTADDRESS_WITHINDEX;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1110
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1111
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1112
    static String getBareHostAddress() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1113
        return BARE_E1000G0HOSTADDRESS;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1114
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1115
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1116
    static byte[] getAddress() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1117
        return E1000G0IPV6ADDRESS;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1118
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1119
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1120
    static int getScopeId() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1121
        return SCOPE_ID_E1000G0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1122
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1123
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1124
    static int getScopeZero() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1125
        return SCOPE_ID_ZERO;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1126
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1127
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1128
    static String getScopeIfName() {
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1129
        return NETWORK_IF_E1000G0;
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1130
    }
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1131
32db080a2a70 8007373: Inet6Address serialization incompatibility
msheppar
parents:
diff changeset
  1132
}