< prev index next >

jdk/test/java/net/Socket/LinkLocal.java

Print this page
rev 17203 : 8180644: move jdk.testlibrary.NetworkConfiguration to the top level test library
Reviewed-by: duke


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4469866
  27  * @summary Connecting to a link-local IPv6 address should not
  28  *          causes a SocketException to be thrown.
  29  * @library /lib/testlibrary
  30  * @build jdk.testlibrary.NetworkConfiguration
  31  * @run main LinkLocal
  32  */
  33 import jdk.testlibrary.NetworkConfiguration;

  34 
  35 import java.net.*;
  36 import java.util.List;
  37 import java.util.stream.Collectors;
  38 
  39 public class LinkLocal {
  40 
  41     static int testCount = 0;
  42     static int failed = 0;
  43 
  44     static void TcpTest(InetAddress ia) throws Exception {
  45         System.out.println("**************************************");
  46         testCount++;
  47         System.out.println("Test " + testCount + ": TCP connect to " + ia);
  48 
  49         /*
  50          * Create ServerSocket on wildcard address and then
  51          * try to connect Socket to link-local address.
  52          */
  53         ServerSocket ss = new ServerSocket(0);




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4469866
  27  * @summary Connecting to a link-local IPv6 address should not
  28  *          causes a SocketException to be thrown.
  29  * @library /test/lib

  30  * @run main LinkLocal
  31  */
  32 
  33 import jdk.test.lib.NetworkConfiguration;
  34 
  35 import java.net.*;
  36 import java.util.List;
  37 import java.util.stream.Collectors;
  38 
  39 public class LinkLocal {
  40 
  41     static int testCount = 0;
  42     static int failed = 0;
  43 
  44     static void TcpTest(InetAddress ia) throws Exception {
  45         System.out.println("**************************************");
  46         testCount++;
  47         System.out.println("Test " + testCount + ": TCP connect to " + ia);
  48 
  49         /*
  50          * Create ServerSocket on wildcard address and then
  51          * try to connect Socket to link-local address.
  52          */
  53         ServerSocket ss = new ServerSocket(0);


< prev index next >