25 * @bug 4675045
26 * @summary Test DatagramChannel send to unresolved address
27 * @library ..
28 */
29
30 import java.io.*;
31 import java.net.*;
32 import java.nio.*;
33 import java.nio.channels.*;
34
35 public class SendToUnresolved {
36 public static void main(String [] argv) throws Exception {
37 String host = TestUtil.UNRESOLVABLE_HOST;
38 DatagramChannel dc = DatagramChannel.open();
39 ByteBuffer bb = ByteBuffer.allocate(4);
40 InetSocketAddress sa = new InetSocketAddress (host, 37);
41 InetAddress inetaddr = sa.getAddress();
42 try {
43 dc.send(bb, sa);
44 throw new RuntimeException("Expected exception not thrown");
45 } catch (IOException e) {
46 // Correct result
47 }
48 dc.close();
49 }
50 }
|
25 * @bug 4675045
26 * @summary Test DatagramChannel send to unresolved address
27 * @library ..
28 */
29
30 import java.io.*;
31 import java.net.*;
32 import java.nio.*;
33 import java.nio.channels.*;
34
35 public class SendToUnresolved {
36 public static void main(String [] argv) throws Exception {
37 String host = TestUtil.UNRESOLVABLE_HOST;
38 DatagramChannel dc = DatagramChannel.open();
39 ByteBuffer bb = ByteBuffer.allocate(4);
40 InetSocketAddress sa = new InetSocketAddress (host, 37);
41 InetAddress inetaddr = sa.getAddress();
42 try {
43 dc.send(bb, sa);
44 throw new RuntimeException("Expected exception not thrown");
45 } catch (IOException | UnresolvedAddressException e) {
46 // Correct result
47 }
48 dc.close();
49 }
50 }
|