test/jdk/java/net/httpclient/InterruptedBlockingSend.java
branchhttp-client-branch
changeset 56233 1753108d07b9
parent 56167 96fa4f49a9ff
child 56265 ec34ae013fbe
equal deleted inserted replaced
56227:278e1c6c3e99 56233:1753108d07b9
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    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
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
       
    24 import java.net.InetSocketAddress;
    24 import java.net.ServerSocket;
    25 import java.net.ServerSocket;
    25 import java.net.URI;
    26 import java.net.URI;
    26 import java.net.http.HttpClient;
    27 import java.net.http.HttpClient;
    27 import java.net.http.HttpRequest;
    28 import java.net.http.HttpRequest;
    28 import java.net.http.HttpResponse.BodyHandlers;
    29 import java.net.http.HttpResponse.BodyHandlers;
    38 
    39 
    39     static volatile Throwable throwable;
    40     static volatile Throwable throwable;
    40 
    41 
    41     public static void main(String[] args) throws Exception {
    42     public static void main(String[] args) throws Exception {
    42         HttpClient client = HttpClient.newHttpClient();
    43         HttpClient client = HttpClient.newHttpClient();
    43         try (ServerSocket ss = new ServerSocket(0, 20)) {
    44         try (ServerSocket ss = new ServerSocket()) {
       
    45             ss.setReuseAddress(false);
       
    46             ss.bind(new InetSocketAddress(0));
    44             int port = ss.getLocalPort();
    47             int port = ss.getLocalPort();
    45             URI uri = new URI("http://127.0.0.1:" + port + "/");
    48             URI uri = new URI("http://127.0.0.1:" + port + "/");
    46 
    49 
    47             HttpRequest request = HttpRequest.newBuilder(uri).build();
    50             HttpRequest request = HttpRequest.newBuilder(uri).build();
    48 
    51