Wisp2SocketCloseExceptionTest.java 727 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * @test
 * @summary Verify that the behavior of read a closed socket is consistent
 * @requires os.family == "linux"
 * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseWisp2 Wisp2SocketCloseExceptionTest
 */

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Wisp2SocketCloseExceptionTest {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(0);
        Socket fd = new Socket("localhost", serverSocket.getLocalPort());
        serverSocket.accept().close();
        InputStream is = fd.getInputStream();
        is.read();
        fd.close();
        is.read();
    }
}