test/jdk/java/nio/channels/DatagramChannel/UseDGWithIPv6.java
changeset 54770 62b6e7587b1f
parent 53427 1cde04cbcec6
child 54811 9db7c0f561a6
equal deleted inserted replaced
54769:925ee7a89325 54770:62b6e7587b1f
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /* @test
    24 /* @test
       
    25  * @library /test/lib
    25  * @bug 6435300
    26  * @bug 6435300
    26  * @summary Check using IPv6 address does not crash the VM
    27  * @summary Check using IPv6 address does not crash the VM
    27  * @run main/othervm UseDGWithIPv6
    28  * @run main/othervm UseDGWithIPv6
    28  * @run main/othervm -Djava.net.preferIPv4Stack=true UseDGWithIPv6
    29  * @run main/othervm -Djava.net.preferIPv4Stack=true UseDGWithIPv6
    29  */
    30  */
    33 import java.net.SocketAddress;
    34 import java.net.SocketAddress;
    34 import java.nio.ByteBuffer;
    35 import java.nio.ByteBuffer;
    35 import java.nio.channels.DatagramChannel;
    36 import java.nio.channels.DatagramChannel;
    36 import java.nio.channels.UnsupportedAddressTypeException;
    37 import java.nio.channels.UnsupportedAddressTypeException;
    37 
    38 
       
    39 import jdk.test.lib.net.IPSupport;
       
    40 
    38 public class UseDGWithIPv6 {
    41 public class UseDGWithIPv6 {
    39     static String[] targets = {
    42     static String[] targets = {
    40         "3ffe:e00:811:b::21:5",
    43         "3ffe:e00:811:b::21:5",
    41         "15.70.186.80"
    44         "15.70.186.80"
    42     };
    45     };
    43     static int BUFFER_LEN = 10;
    46     static int BUFFER_LEN = 10;
    44     static int port = 12345;
    47     static int port = 12345;
    45 
    48 
    46     public static void main(String[] args) throws IOException
    49     public static void main(String[] args) throws IOException
    47     {
    50     {
       
    51         IPSupport.skipIfCurrentConfigurationIsInvalid();
       
    52 
    48         ByteBuffer data = ByteBuffer.wrap("TESTING DATA".getBytes());
    53         ByteBuffer data = ByteBuffer.wrap("TESTING DATA".getBytes());
    49         DatagramChannel dgChannel = DatagramChannel.open();
    54         DatagramChannel dgChannel = DatagramChannel.open();
    50 
    55 
    51         for(int i = 0; i < targets.length; i++){
    56         for(int i = 0; i < targets.length; i++){
    52             data.rewind();
    57             data.rewind();