48083
|
1 |
/*
|
50681
|
2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
48083
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
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
|
|
21 |
* questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
import javax.net.ssl.SSLSession;
|
|
25 |
import java.io.InputStream;
|
|
26 |
import java.net.URI;
|
50681
|
27 |
import java.net.http.HttpHeaders;
|
|
28 |
import jdk.internal.net.http.common.HttpHeadersBuilder;
|
48083
|
29 |
|
|
30 |
/**
|
|
31 |
* A supplier of Http2TestExchanges. If the default Http2TestExchange impl is
|
|
32 |
* not sufficient, then a supplier may be set on an Http2TestServer through its
|
|
33 |
* {@link Http2TestServer#setExchangeSupplier(Http2TestExchangeSupplier)}.
|
|
34 |
*
|
|
35 |
* Useful for testing scenarios where non-standard or specific server behaviour
|
|
36 |
* is required, either direct control over the frames sent, "bad" behaviour, or
|
|
37 |
* something else.
|
|
38 |
*/
|
|
39 |
public interface Http2TestExchangeSupplier {
|
|
40 |
|
|
41 |
Http2TestExchange get(int streamid,
|
|
42 |
String method,
|
50681
|
43 |
HttpHeaders reqheaders,
|
|
44 |
HttpHeadersBuilder rspheadersBuilder,
|
48083
|
45 |
URI uri,
|
|
46 |
InputStream is,
|
|
47 |
SSLSession sslSession,
|
|
48 |
BodyOutputStream os,
|
|
49 |
Http2TestServerConnection conn,
|
|
50 |
boolean pushAllowed);
|
|
51 |
|
|
52 |
static Http2TestExchangeSupplier ofDefault() {
|
|
53 |
return Http2TestExchangeImpl::new;
|
|
54 |
}
|
|
55 |
}
|