jdk/test/java/net/NetworkInterface/IPv4Only.java
changeset 27565 729f9700483a
parent 6116 3880a05ff32e
equal deleted inserted replaced
27564:eaaa79b68cd5 27565:729f9700483a
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /* @test
    24 /* @test
    25  * @bug   6964714
    25  * @bug   6964714
    26  * @run main/othervm IPv4Only
    26  * @run main/othervm -Djava.net.preferIPv4Stack=true IPv4Only
    27  * @summary Test the networkinterface listing with java.net.preferIPv4Stack=true.
    27  * @summary Test the networkinterface listing with java.net.preferIPv4Stack=true.
    28  */
    28  */
    29 
    29 
    30 
    30 
    31 import java.net.*;
    31 import java.net.*;
    32 import java.util.*;
    32 import java.util.*;
    33 
    33 
    34 
    34 
    35 public class IPv4Only {
    35 public class IPv4Only {
    36     public static void main(String[] args) throws Exception {
    36     public static void main(String[] args) throws Exception {
    37         System.setProperty("java.net.preferIPv4Stack","true");
       
    38 
       
    39         Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
    37         Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
    40         while (nifs.hasMoreElements()) {
    38         while (nifs.hasMoreElements()) {
    41             NetworkInterface nif = nifs.nextElement();
    39             NetworkInterface nif = nifs.nextElement();
    42             Enumeration<InetAddress> addrs = nif.getInetAddresses();
    40             Enumeration<InetAddress> addrs = nif.getInetAddresses();
    43             while (addrs.hasMoreElements()) {
    41             while (addrs.hasMoreElements()) {