author | dfuchs |
Tue, 06 Feb 2018 11:04:44 +0000 | |
branch | http-client-branch |
changeset 56076 | 9a2855e0a796 |
parent 48083 | b1c1b4ef4be2 |
child 56089 | 42208b2f224e |
permissions | -rw-r--r-- |
46157 | 1 |
/* |
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
|
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 com.sun.net.httpserver.HttpContext; |
|
25 |
import com.sun.net.httpserver.HttpExchange; |
|
26 |
import com.sun.net.httpserver.HttpHandler; |
|
27 |
import com.sun.net.httpserver.HttpServer; |
|
28 |
import com.sun.net.httpserver.HttpsConfigurator; |
|
29 |
import com.sun.net.httpserver.HttpsParameters; |
|
30 |
import com.sun.net.httpserver.HttpsServer; |
|
31 |
import java.io.IOException; |
|
32 |
import java.io.InputStream; |
|
33 |
import java.io.OutputStream; |
|
34 |
import java.io.OutputStreamWriter; |
|
35 |
import java.io.PrintWriter; |
|
36 |
import java.io.Writer; |
|
37 |
import java.net.HttpURLConnection; |
|
38 |
import java.net.InetAddress; |
|
39 |
import java.net.InetSocketAddress; |
|
40 |
import java.net.Proxy; |
|
41 |
import java.net.ProxySelector; |
|
42 |
import java.net.ServerSocket; |
|
43 |
import java.net.Socket; |
|
44 |
import java.net.URI; |
|
45 |
import java.net.URISyntaxException; |
|
46 |
import java.nio.charset.StandardCharsets; |
|
47 |
import java.security.NoSuchAlgorithmException; |
|
48 |
import javax.net.ssl.HostnameVerifier; |
|
49 |
import javax.net.ssl.HttpsURLConnection; |
|
50 |
import javax.net.ssl.SSLContext; |
|
51 |
import javax.net.ssl.SSLSession; |
|
52 |
import jdk.incubator.http.HttpClient; |
|
53 |
import jdk.incubator.http.HttpRequest; |
|
54 |
import jdk.incubator.http.HttpResponse; |
|
55 |
import jdk.testlibrary.SimpleSSLContext; |
|
56 |
import java.util.concurrent.*; |
|
57 |
||
58 |
/** |
|
59 |
* @test |
|
60 |
* @bug 8181422 |
|
61 |
* @summary Verifies that you can access an HTTP/2 server over HTTPS by |
|
62 |
* tunnelling through an HTTP/1.1 proxy. |
|
63 |
* @modules jdk.incubator.httpclient |
|
64 |
* @library /lib/testlibrary server |
|
48083 | 65 |
* @modules java.base/sun.net.www.http |
66 |
* jdk.incubator.httpclient/jdk.incubator.http.internal.common |
|
46157 | 67 |
* jdk.incubator.httpclient/jdk.incubator.http.internal.frame |
68 |
* jdk.incubator.httpclient/jdk.incubator.http.internal.hpack |
|
69 |
* @build jdk.testlibrary.SimpleSSLContext ProxyTest2 |
|
70 |
* @run main/othervm ProxyTest2 |
|
71 |
* @author danielfuchs |
|
72 |
*/ |
|
73 |
public class ProxyTest2 { |
|
74 |
||
75 |
static { |
|
76 |
try { |
|
77 |
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { |
|
78 |
public boolean verify(String hostname, SSLSession session) { |
|
79 |
return true; |
|
80 |
} |
|
81 |
}); |
|
82 |
SSLContext.setDefault(new SimpleSSLContext().get()); |
|
83 |
} catch (IOException ex) { |
|
84 |
throw new ExceptionInInitializerError(ex); |
|
85 |
} |
|
86 |
} |
|
87 |
||
88 |
static final String RESPONSE = "<html><body><p>Hello World!</body></html>"; |
|
89 |
static final String PATH = "/foo/"; |
|
90 |
||
91 |
static Http2TestServer createHttpsServer(ExecutorService exec) throws Exception { |
|
92 |
Http2TestServer server = new Http2TestServer(true, 0, exec, SSLContext.getDefault()); |
|
93 |
server.addHandler(new Http2Handler() { |
|
94 |
@Override |
|
95 |
public void handle(Http2TestExchange he) throws IOException { |
|
96 |
he.getResponseHeaders().addHeader("encoding", "UTF-8"); |
|
97 |
he.sendResponseHeaders(200, RESPONSE.length()); |
|
98 |
he.getResponseBody().write(RESPONSE.getBytes(StandardCharsets.UTF_8)); |
|
99 |
he.close(); |
|
100 |
} |
|
101 |
}, PATH); |
|
102 |
||
103 |
return server; |
|
104 |
} |
|
105 |
||
106 |
public static void main(String[] args) |
|
107 |
throws Exception |
|
108 |
{ |
|
109 |
ExecutorService exec = Executors.newCachedThreadPool(); |
|
110 |
Http2TestServer server = createHttpsServer(exec); |
|
111 |
server.start(); |
|
112 |
try { |
|
113 |
// Http2TestServer over HTTPS does not support HTTP/1.1 |
|
114 |
// => only test with a HTTP/2 client |
|
115 |
test(server, HttpClient.Version.HTTP_2); |
|
116 |
} finally { |
|
117 |
server.stop(); |
|
118 |
exec.shutdown(); |
|
119 |
System.out.println("Server stopped"); |
|
120 |
} |
|
121 |
} |
|
122 |
||
123 |
public static void test(Http2TestServer server, HttpClient.Version version) |
|
124 |
throws Exception |
|
125 |
{ |
|
126 |
System.out.println("Server is: " + server.getAddress().toString()); |
|
127 |
URI uri = new URI("https://localhost:" + server.getAddress().getPort() + PATH + "x"); |
|
128 |
TunnelingProxy proxy = new TunnelingProxy(server); |
|
129 |
proxy.start(); |
|
130 |
try { |
|
131 |
System.out.println("Proxy started"); |
|
132 |
Proxy p = new Proxy(Proxy.Type.HTTP, |
|
133 |
InetSocketAddress.createUnresolved("localhost", proxy.getAddress().getPort())); |
|
134 |
System.out.println("Setting up request with HttpClient for version: " |
|
135 |
+ version.name() + "URI=" + uri); |
|
136 |
ProxySelector ps = ProxySelector.of( |
|
137 |
InetSocketAddress.createUnresolved("localhost", proxy.getAddress().getPort())); |
|
138 |
HttpClient client = HttpClient.newBuilder() |
|
139 |
.version(version) |
|
140 |
.proxy(ps) |
|
141 |
.build(); |
|
142 |
HttpRequest request = HttpRequest.newBuilder() |
|
143 |
.uri(uri) |
|
144 |
.GET() |
|
145 |
.build(); |
|
146 |
||
147 |
System.out.println("Sending request with HttpClient"); |
|
148 |
HttpResponse<String> response |
|
149 |
= client.send(request, HttpResponse.BodyHandler.asString()); |
|
150 |
System.out.println("Got response"); |
|
151 |
String resp = response.body(); |
|
152 |
System.out.println("Received: " + resp); |
|
153 |
if (!RESPONSE.equals(resp)) { |
|
154 |
throw new AssertionError("Unexpected response"); |
|
155 |
} |
|
156 |
} finally { |
|
157 |
System.out.println("Stopping proxy"); |
|
158 |
proxy.stop(); |
|
159 |
System.out.println("Proxy stopped"); |
|
160 |
} |
|
161 |
} |
|
162 |
||
163 |
static class TunnelingProxy { |
|
164 |
final Thread accept; |
|
165 |
final ServerSocket ss; |
|
166 |
final boolean DEBUG = false; |
|
167 |
final Http2TestServer serverImpl; |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
168 |
final CopyOnWriteArrayList<CompletableFuture<Void>> connectionCFs |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
169 |
= new CopyOnWriteArrayList<>(); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
170 |
private volatile boolean stopped; |
46157 | 171 |
TunnelingProxy(Http2TestServer serverImpl) throws IOException { |
172 |
this.serverImpl = serverImpl; |
|
173 |
ss = new ServerSocket(); |
|
174 |
accept = new Thread(this::accept); |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
175 |
accept.setDaemon(true); |
46157 | 176 |
} |
177 |
||
178 |
void start() throws IOException { |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
179 |
ss.bind(new InetSocketAddress(0)); |
46157 | 180 |
accept.start(); |
181 |
} |
|
182 |
||
183 |
// Pipe the input stream to the output stream. |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
184 |
private synchronized Thread pipe(InputStream is, OutputStream os, |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
185 |
char tag, CompletableFuture<Void> end) { |
46157 | 186 |
return new Thread("TunnelPipe("+tag+")") { |
187 |
@Override |
|
188 |
public void run() { |
|
189 |
try { |
|
190 |
try { |
|
191 |
int c; |
|
192 |
while ((c = is.read()) != -1) { |
|
193 |
os.write(c); |
|
194 |
os.flush(); |
|
195 |
// if DEBUG prints a + or a - for each transferred |
|
196 |
// character. |
|
197 |
if (DEBUG) System.out.print(tag); |
|
198 |
} |
|
199 |
is.close(); |
|
200 |
} finally { |
|
201 |
os.close(); |
|
202 |
} |
|
203 |
} catch (IOException ex) { |
|
204 |
if (DEBUG) ex.printStackTrace(System.out); |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
205 |
} finally { |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
206 |
end.complete(null); |
46157 | 207 |
} |
208 |
} |
|
209 |
}; |
|
210 |
} |
|
211 |
||
212 |
public InetSocketAddress getAddress() { |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
213 |
return new InetSocketAddress( |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
214 |
"localhost", |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
215 |
ss.getLocalPort()); |
46157 | 216 |
} |
217 |
||
218 |
// This is a bit shaky. It doesn't handle continuation |
|
219 |
// lines, but our client shouldn't send any. |
|
220 |
// Read a line from the input stream, swallowing the final |
|
221 |
// \r\n sequence. Stops at the first \n, doesn't complain |
|
222 |
// if it wasn't preceded by '\r'. |
|
223 |
// |
|
224 |
String readLine(InputStream r) throws IOException { |
|
225 |
StringBuilder b = new StringBuilder(); |
|
226 |
int c; |
|
227 |
while ((c = r.read()) != -1) { |
|
228 |
if (c == '\n') break; |
|
229 |
b.appendCodePoint(c); |
|
230 |
} |
|
231 |
if (b.codePointAt(b.length() -1) == '\r') { |
|
232 |
b.delete(b.length() -1, b.length()); |
|
233 |
} |
|
234 |
return b.toString(); |
|
235 |
} |
|
236 |
||
237 |
public void accept() { |
|
238 |
Socket clientConnection = null; |
|
239 |
try { |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
240 |
while (!stopped) { |
46157 | 241 |
System.out.println("Tunnel: Waiting for client"); |
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
242 |
Socket toClose; |
46157 | 243 |
try { |
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
244 |
toClose = clientConnection = ss.accept(); |
46157 | 245 |
} catch (IOException io) { |
246 |
if (DEBUG) io.printStackTrace(System.out); |
|
247 |
break; |
|
248 |
} |
|
249 |
System.out.println("Tunnel: Client accepted"); |
|
250 |
Socket targetConnection = null; |
|
251 |
InputStream ccis = clientConnection.getInputStream(); |
|
252 |
OutputStream ccos = clientConnection.getOutputStream(); |
|
253 |
Writer w = new OutputStreamWriter(ccos, "UTF-8"); |
|
254 |
PrintWriter pw = new PrintWriter(w); |
|
255 |
System.out.println("Tunnel: Reading request line"); |
|
256 |
String requestLine = readLine(ccis); |
|
257 |
System.out.println("Tunnel: Request status line: " + requestLine); |
|
258 |
if (requestLine.startsWith("CONNECT ")) { |
|
259 |
// We should probably check that the next word following |
|
260 |
// CONNECT is the host:port of our HTTPS serverImpl. |
|
261 |
// Some improvement for a followup! |
|
262 |
||
263 |
// Read all headers until we find the empty line that |
|
264 |
// signals the end of all headers. |
|
265 |
while(!requestLine.equals("")) { |
|
266 |
System.out.println("Tunnel: Reading header: " |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
267 |
+ (requestLine = readLine(ccis))); |
46157 | 268 |
} |
269 |
||
270 |
// Open target connection |
|
271 |
targetConnection = new Socket( |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
272 |
InetAddress.getLoopbackAddress(), |
46157 | 273 |
serverImpl.getAddress().getPort()); |
274 |
||
275 |
// Then send the 200 OK response to the client |
|
276 |
System.out.println("Tunnel: Sending " |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
277 |
+ "HTTP/1.1 200 OK\r\n\r\n"); |
46157 | 278 |
pw.print("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); |
279 |
pw.flush(); |
|
280 |
} else { |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
281 |
// This should not happen. If it does then just print an |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
282 |
// error - both on out and err, and close the accepted |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
283 |
// socket |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
284 |
System.out.println("WARNING: Tunnel: Unexpected status line: " |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
285 |
+ requestLine + " received by " |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
286 |
+ ss.getLocalSocketAddress() |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
287 |
+ " from " |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
288 |
+ toClose.getRemoteSocketAddress() |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
289 |
+ " - closing accepted socket"); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
290 |
// Print on err |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
291 |
System.err.println("WARNING: Tunnel: Unexpected status line: " |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
292 |
+ requestLine + " received by " |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
293 |
+ ss.getLocalSocketAddress() |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
294 |
+ " from " |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
295 |
+ toClose.getRemoteSocketAddress()); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
296 |
// close accepted socket. |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
297 |
toClose.close(); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
298 |
System.err.println("Tunnel: accepted socket closed."); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
299 |
continue; |
46157 | 300 |
} |
301 |
||
302 |
// Pipe the input stream of the client connection to the |
|
303 |
// output stream of the target connection and conversely. |
|
304 |
// Now the client and target will just talk to each other. |
|
305 |
System.out.println("Tunnel: Starting tunnel pipes"); |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
306 |
CompletableFuture<Void> end, end1, end2; |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
307 |
Thread t1 = pipe(ccis, targetConnection.getOutputStream(), '+', |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
308 |
end1 = new CompletableFuture<>()); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
309 |
Thread t2 = pipe(targetConnection.getInputStream(), ccos, '-', |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
310 |
end2 = new CompletableFuture<>()); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
311 |
end = CompletableFuture.allOf(end1, end2); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
312 |
end.whenComplete( |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
313 |
(r,t) -> { |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
314 |
try { toClose.close(); } catch (IOException x) { } |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
315 |
finally {connectionCFs.remove(end);} |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
316 |
}); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
317 |
connectionCFs.add(end); |
46157 | 318 |
t1.start(); |
319 |
t2.start(); |
|
320 |
} |
|
321 |
} catch (Throwable ex) { |
|
322 |
try { |
|
323 |
ss.close(); |
|
324 |
} catch (IOException ex1) { |
|
325 |
ex.addSuppressed(ex1); |
|
326 |
} |
|
327 |
ex.printStackTrace(System.err); |
|
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
328 |
} finally { |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
329 |
System.out.println("Tunnel: exiting (stopped=" + stopped + ")"); |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
330 |
connectionCFs.forEach(cf -> cf.complete(null)); |
46157 | 331 |
} |
332 |
} |
|
333 |
||
56076
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
334 |
public void stop() throws IOException { |
9a2855e0a796
http-client-branch: more binding to 0.0.0.0 instead of localhost/127.0.0.1
dfuchs
parents:
48083
diff
changeset
|
335 |
stopped = true; |
46157 | 336 |
ss.close(); |
337 |
} |
|
338 |
||
339 |
} |
|
340 |
||
341 |
static class Configurator extends HttpsConfigurator { |
|
342 |
public Configurator(SSLContext ctx) { |
|
343 |
super(ctx); |
|
344 |
} |
|
345 |
||
346 |
@Override |
|
347 |
public void configure (HttpsParameters params) { |
|
348 |
params.setSSLParameters (getSSLContext().getSupportedSSLParameters()); |
|
349 |
} |
|
350 |
} |
|
351 |
||
352 |
} |