test/jdk/java/net/httpclient/http2/server/Http2TestExchangeSupplier.java
author chegar
Thu, 16 Nov 2017 10:01:34 +0000
branchhttp-client-branch
changeset 55817 2aec8081d2ad
child 49765 ee6f7a61f3a5
child 56089 42208b2f224e
permissions -rw-r--r--
http-client-branch: Add a test for CONTINUATION frame handling
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55817
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     1
/*
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     4
 *
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     8
 *
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    13
 * accompanied this code).
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    14
 *
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    18
 *
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    21
 * questions.
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    22
 */
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    23
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    24
import javax.net.ssl.SSLSession;
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    25
import java.io.InputStream;
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    26
import java.net.URI;
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    27
import jdk.incubator.http.internal.common.HttpHeadersImpl;
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    28
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    29
/**
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    30
 * A supplier of Http2TestExchanges. If the default Http2TestExchange impl is
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    31
 * not sufficient, then a supplier may be set on an Http2TestServer through its
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    32
 * {@link Http2TestServer#setExchangeSupplier(Http2TestExchangeSupplier)}.
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    33
 *
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    34
 * Useful for testing scenarios where non-standard or specific server behaviour
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    35
 * is required, either direct control over the frames sent, "bad" behaviour, or
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    36
 * something else.
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    37
 */
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    38
public interface Http2TestExchangeSupplier {
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    39
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    40
    Http2TestExchange get(int streamid,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    41
                          String method,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    42
                          HttpHeadersImpl reqheaders,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    43
                          HttpHeadersImpl rspheaders,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    44
                          URI uri,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    45
                          InputStream is,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    46
                          SSLSession sslSession,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    47
                          BodyOutputStream os,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    48
                          Http2TestServerConnection conn,
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    49
                          boolean pushAllowed);
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    50
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    51
    static Http2TestExchangeSupplier ofDefault() {
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    52
        return Http2TestExchangeImpl::new;
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    53
    }
2aec8081d2ad http-client-branch: Add a test for CONTINUATION frame handling
chegar
parents:
diff changeset
    54
}