jdk/test/java/nio/channels/DatagramChannel/NoSender.java
changeset 5788 50d4ad1a780f
parent 5506 202f599c92aa
child 7668 d4a77089c587
equal deleted inserted replaced
5787:a0af7b8e80ed 5788:50d4ad1a780f
    31 import java.nio.channels.*;
    31 import java.nio.channels.*;
    32 
    32 
    33 public class NoSender {
    33 public class NoSender {
    34     public static void main(String argv[]) throws Exception {
    34     public static void main(String argv[]) throws Exception {
    35         DatagramChannel dc = DatagramChannel.open();
    35         DatagramChannel dc = DatagramChannel.open();
    36         dc.socket().bind(new InetSocketAddress(5441));
    36         dc.socket().bind(new InetSocketAddress(0));
    37         dc.configureBlocking(false);
    37         dc.configureBlocking(false);
    38         ByteBuffer buf1 = ByteBuffer.allocateDirect(256);
    38         ByteBuffer buf1 = ByteBuffer.allocateDirect(256);
    39         SocketAddress sa1 = dc.receive(buf1);
    39         SocketAddress sa1 = dc.receive(buf1);
    40         if (sa1 != null)
    40         if (sa1 != null)
    41             throw new RuntimeException("Test failed");
    41             throw new RuntimeException("Test failed");