test/jdk/java/net/httpclient/http2/server/Http2TestExchange.java
author michaelm
Fri, 24 Nov 2017 17:34:57 +0000
branchhttp-client-branch
changeset 55868 5899aa5e1837
parent 55817 2aec8081d2ad
child 55871 45c88bf0592b
permissions -rw-r--r--
http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     1
/*
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     4
 *
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     8
 *
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    13
 * accompanied this code).
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    14
 *
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    18
 *
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    21
 * questions.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    22
 */
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    23
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    24
import java.io.IOException;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    25
import java.io.InputStream;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    26
import java.io.OutputStream;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    27
import java.net.URI;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    28
import java.net.InetSocketAddress;
55868
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    29
import java.util.concurrent.CompletableFuture;
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    30
import java.util.function.Consumer;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    31
import javax.net.ssl.SSLSession;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    32
import jdk.incubator.http.internal.common.HttpHeadersImpl;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    33
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    34
public interface Http2TestExchange {
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    35
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    36
    HttpHeadersImpl getRequestHeaders();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    37
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    38
    HttpHeadersImpl getResponseHeaders();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    39
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    40
    URI getRequestURI();
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    41
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    42
    String getRequestMethod();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    43
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    44
    SSLSession getSSLSession();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    45
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    46
    void close();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    47
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    48
    InputStream getRequestBody();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    49
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    50
    OutputStream getResponseBody();
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    51
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    52
    void sendResponseHeaders(int rCode, long responseLength) throws IOException;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    53
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    54
    InetSocketAddress getRemoteAddress();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    55
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    56
    int getResponseCode();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    57
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    58
    InetSocketAddress getLocalAddress();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    59
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    60
    String getProtocol();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    61
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    62
    boolean serverPushAllowed();
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    63
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents: 47216
diff changeset
    64
    void serverPush(URI uri, HttpHeadersImpl headers, InputStream content);
55868
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    65
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    66
    /**
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    67
     * Send a PING on this exchanges connection, and complete the given CF
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    68
     * with the number of milliseconds it took to get a valid response.
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    69
     * It may also complete exceptionally
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    70
     */
5899aa5e1837 http-client-branch: added ping support to test http2 server and some test pings from server to client in the BasicTest
michaelm
parents: 55817
diff changeset
    71
    void sendPing(CompletableFuture<Long> cf) throws IOException;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    72
}