< prev index next >
test/jdk/java/net/httpclient/http2/ServerPush.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 24,45 ****
/*
* @test
* @bug 8087112 8159814
* @library /lib/testlibrary server
* @build jdk.testlibrary.SimpleSSLContext
! * @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common
* jdk.incubator.httpclient/jdk.incubator.http.internal.frame
* jdk.incubator.httpclient/jdk.incubator.http.internal.hpack
! * @run testng/othervm -Djdk.httpclient.HttpClient.log=errors,requests,responses ServerPush
*/
import java.io.*;
import java.net.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import jdk.incubator.http.*;
! import jdk.incubator.http.HttpResponse.MultiProcessor;
import jdk.incubator.http.HttpResponse.BodyHandler;
import java.util.*;
import java.util.concurrent.*;
import org.testng.annotations.Test;
--- 24,46 ----
/*
* @test
* @bug 8087112 8159814
* @library /lib/testlibrary server
* @build jdk.testlibrary.SimpleSSLContext
! * @modules java.base/sun.net.www.http
! * jdk.incubator.httpclient/jdk.incubator.http.internal.common
* jdk.incubator.httpclient/jdk.incubator.http.internal.frame
* jdk.incubator.httpclient/jdk.incubator.http.internal.hpack
! * @run testng/othervm -Djdk.internal.httpclient.hpack.debug=true -Djdk.internal.httpclient.debug=true -Djdk.httpclient.HttpClient.log=errors,requests,responses ServerPush
*/
import java.io.*;
import java.net.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import jdk.incubator.http.*;
! import jdk.incubator.http.HttpResponse.MultiSubscriber;
import jdk.incubator.http.HttpResponse.BodyHandler;
import java.util.*;
import java.util.concurrent.*;
import org.testng.annotations.Test;
*** 50,60 ****
static final int LOOPS = 13;
static final int FILE_SIZE = 512 * 1024 + 343;
static Path tempFile;
! @Test(timeOut=30000)
public static void test() throws Exception {
Http2TestServer server = null;
final Path dir = Files.createTempDirectory("serverPush");
try {
server = new Http2TestServer(false, 0);
--- 51,61 ----
static final int LOOPS = 13;
static final int FILE_SIZE = 512 * 1024 + 343;
static Path tempFile;
! @Test
public static void test() throws Exception {
Http2TestServer server = null;
final Path dir = Files.createTempDirectory("serverPush");
try {
server = new Http2TestServer(false, 0);
*** 70,80 ****
HttpRequest request = HttpRequest.newBuilder(uri).GET().build();
CompletableFuture<MultiMapResult<Path>> cf =
HttpClient.newBuilder().version(HttpClient.Version.HTTP_2)
.executor(e).build().sendAsync(
! request, MultiProcessor.asMap((req) -> {
URI u = req.uri();
Path path = Paths.get(dir.toString(), u.getPath());
try {
Files.createDirectories(path.getParent());
} catch (IOException ee) {
--- 71,81 ----
HttpRequest request = HttpRequest.newBuilder(uri).GET().build();
CompletableFuture<MultiMapResult<Path>> cf =
HttpClient.newBuilder().version(HttpClient.Version.HTTP_2)
.executor(e).build().sendAsync(
! request, MultiSubscriber.asMap((req) -> {
URI u = req.uri();
Path path = Paths.get(dir.toString(), u.getPath());
try {
Files.createDirectories(path.getParent());
} catch (IOException ee) {
< prev index next >