test/jdk/java/nio/channels/SocketChannel/SocketInheritance.java
changeset 54086 ccb4a50bee06
parent 47216 71c04702a3d5
equal deleted inserted replaced
54085:ab87b06dfdc0 54086:ccb4a50bee06
     1 /*
     1 /*
     2  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    63 
    63 
    64     }
    64     }
    65 
    65 
    66     // connect to the given port
    66     // connect to the given port
    67     static SocketChannel connect(int port) throws IOException {
    67     static SocketChannel connect(int port) throws IOException {
    68         InetAddress lh = InetAddress.getByName("127.0.0.1");
    68         InetAddress lh = InetAddress.getLoopbackAddress();
    69         InetSocketAddress isa = new InetSocketAddress(lh, port);
    69         InetSocketAddress isa = new InetSocketAddress(lh, port);
    70         return SocketChannel.open(isa);
    70         return SocketChannel.open(isa);
    71     }
    71     }
    72 
    72 
    73     // simple child process that handshakes with the parent and then
    73     // simple child process that handshakes with the parent and then