test/jdk/java/net/httpclient/http2/ProxyTest2.java
author michaelm
Tue, 16 Jan 2018 15:52:01 +0000
branchhttp-client-branch
changeset 56010 782b2f2d1e76
parent 48083 b1c1b4ef4be2
child 49765 ee6f7a61f3a5
child 56076 9a2855e0a796
permissions -rw-r--r--
http-client-branch: updated server push API
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46157
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     1
/*
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     4
 *
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     8
 *
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    13
 * accompanied this code).
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    14
 *
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    18
 *
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    21
 * questions.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    22
 */
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    23
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    24
import com.sun.net.httpserver.HttpContext;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    25
import com.sun.net.httpserver.HttpExchange;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    26
import com.sun.net.httpserver.HttpHandler;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    27
import com.sun.net.httpserver.HttpServer;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    28
import com.sun.net.httpserver.HttpsConfigurator;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    29
import com.sun.net.httpserver.HttpsParameters;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    30
import com.sun.net.httpserver.HttpsServer;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    31
import java.io.IOException;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    32
import java.io.InputStream;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    33
import java.io.OutputStream;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    34
import java.io.OutputStreamWriter;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    35
import java.io.PrintWriter;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    36
import java.io.Writer;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    37
import java.net.HttpURLConnection;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    38
import java.net.InetAddress;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    39
import java.net.InetSocketAddress;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    40
import java.net.Proxy;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    41
import java.net.ProxySelector;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    42
import java.net.ServerSocket;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    43
import java.net.Socket;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    44
import java.net.URI;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    45
import java.net.URISyntaxException;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    46
import java.nio.charset.StandardCharsets;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    47
import java.security.NoSuchAlgorithmException;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    48
import javax.net.ssl.HostnameVerifier;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    49
import javax.net.ssl.HttpsURLConnection;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    50
import javax.net.ssl.SSLContext;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    51
import javax.net.ssl.SSLSession;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    52
import jdk.incubator.http.HttpClient;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    53
import jdk.incubator.http.HttpRequest;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    54
import jdk.incubator.http.HttpResponse;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    55
import jdk.testlibrary.SimpleSSLContext;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    56
import java.util.concurrent.*;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    57
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    58
/**
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    59
 * @test
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    60
 * @bug 8181422
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    61
 * @summary  Verifies that you can access an HTTP/2 server over HTTPS by
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    62
 *           tunnelling through an HTTP/1.1 proxy.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    63
 * @modules jdk.incubator.httpclient
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    64
 * @library /lib/testlibrary server
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    65
 * @modules java.base/sun.net.www.http
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    66
 *          jdk.incubator.httpclient/jdk.incubator.http.internal.common
46157
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    67
 *          jdk.incubator.httpclient/jdk.incubator.http.internal.frame
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    68
 *          jdk.incubator.httpclient/jdk.incubator.http.internal.hpack
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    69
 * @build jdk.testlibrary.SimpleSSLContext ProxyTest2
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    70
 * @run main/othervm ProxyTest2
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    71
 * @author danielfuchs
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    72
 */
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    73
public class ProxyTest2 {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    74
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    75
    static {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    76
        try {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    77
            HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    78
                    public boolean verify(String hostname, SSLSession session) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    79
                        return true;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    80
                    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    81
                });
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    82
            SSLContext.setDefault(new SimpleSSLContext().get());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    83
        } catch (IOException ex) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    84
            throw new ExceptionInInitializerError(ex);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    85
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    86
    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    87
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    88
    static final String RESPONSE = "<html><body><p>Hello World!</body></html>";
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    89
    static final String PATH = "/foo/";
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    90
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    91
    static Http2TestServer createHttpsServer(ExecutorService exec) throws Exception {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    92
        Http2TestServer server = new Http2TestServer(true, 0, exec, SSLContext.getDefault());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    93
        server.addHandler(new Http2Handler() {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    94
            @Override
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    95
            public void handle(Http2TestExchange he) throws IOException {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    96
                he.getResponseHeaders().addHeader("encoding", "UTF-8");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    97
                he.sendResponseHeaders(200, RESPONSE.length());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    98
                he.getResponseBody().write(RESPONSE.getBytes(StandardCharsets.UTF_8));
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
    99
                he.close();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   100
            }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   101
        }, PATH);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   102
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   103
        return server;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   104
    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   105
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   106
    public static void main(String[] args)
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   107
            throws Exception
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   108
    {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   109
        ExecutorService exec = Executors.newCachedThreadPool();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   110
        Http2TestServer server = createHttpsServer(exec);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   111
        server.start();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   112
        try {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   113
            // Http2TestServer over HTTPS does not support HTTP/1.1
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   114
            // => only test with a HTTP/2 client
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   115
            test(server, HttpClient.Version.HTTP_2);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   116
        } finally {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   117
            server.stop();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   118
            exec.shutdown();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   119
            System.out.println("Server stopped");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   120
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   121
    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   122
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   123
    public static void test(Http2TestServer server, HttpClient.Version version)
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   124
            throws Exception
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   125
    {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   126
        System.out.println("Server is: " + server.getAddress().toString());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   127
        URI uri = new URI("https://localhost:" + server.getAddress().getPort() + PATH + "x");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   128
        TunnelingProxy proxy = new TunnelingProxy(server);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   129
        proxy.start();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   130
        try {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   131
            System.out.println("Proxy started");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   132
            Proxy p = new Proxy(Proxy.Type.HTTP,
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   133
                    InetSocketAddress.createUnresolved("localhost", proxy.getAddress().getPort()));
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   134
            System.out.println("Setting up request with HttpClient for version: "
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   135
                    + version.name() + "URI=" + uri);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   136
            ProxySelector ps = ProxySelector.of(
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   137
                    InetSocketAddress.createUnresolved("localhost", proxy.getAddress().getPort()));
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   138
            HttpClient client = HttpClient.newBuilder()
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   139
                .version(version)
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   140
                .proxy(ps)
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   141
                .build();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   142
            HttpRequest request = HttpRequest.newBuilder()
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   143
                .uri(uri)
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   144
                .GET()
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   145
                .build();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   146
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   147
            System.out.println("Sending request with HttpClient");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   148
            HttpResponse<String> response
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   149
                = client.send(request, HttpResponse.BodyHandler.asString());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   150
            System.out.println("Got response");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   151
            String resp = response.body();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   152
            System.out.println("Received: " + resp);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   153
            if (!RESPONSE.equals(resp)) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   154
                throw new AssertionError("Unexpected response");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   155
            }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   156
        } finally {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   157
            System.out.println("Stopping proxy");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   158
            proxy.stop();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   159
            System.out.println("Proxy stopped");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   160
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   161
    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   162
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   163
    static class TunnelingProxy {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   164
        final Thread accept;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   165
        final ServerSocket ss;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   166
        final boolean DEBUG = false;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   167
        final Http2TestServer serverImpl;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   168
        TunnelingProxy(Http2TestServer serverImpl) throws IOException {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   169
            this.serverImpl = serverImpl;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   170
            ss = new ServerSocket();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   171
            accept = new Thread(this::accept);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   172
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   173
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   174
        void start() throws IOException {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   175
            ss.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   176
            accept.start();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   177
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   178
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   179
        // Pipe the input stream to the output stream.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   180
        private synchronized Thread pipe(InputStream is, OutputStream os, char tag) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   181
            return new Thread("TunnelPipe("+tag+")") {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   182
                @Override
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   183
                public void run() {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   184
                    try {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   185
                        try {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   186
                            int c;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   187
                            while ((c = is.read()) != -1) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   188
                                os.write(c);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   189
                                os.flush();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   190
                                // if DEBUG prints a + or a - for each transferred
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   191
                                // character.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   192
                                if (DEBUG) System.out.print(tag);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   193
                            }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   194
                            is.close();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   195
                        } finally {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   196
                            os.close();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   197
                        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   198
                    } catch (IOException ex) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   199
                        if (DEBUG) ex.printStackTrace(System.out);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   200
                    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   201
                }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   202
            };
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   203
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   204
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   205
        public InetSocketAddress getAddress() {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   206
            return new InetSocketAddress(ss.getInetAddress(), ss.getLocalPort());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   207
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   208
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   209
        // This is a bit shaky. It doesn't handle continuation
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   210
        // lines, but our client shouldn't send any.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   211
        // Read a line from the input stream, swallowing the final
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   212
        // \r\n sequence. Stops at the first \n, doesn't complain
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   213
        // if it wasn't preceded by '\r'.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   214
        //
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   215
        String readLine(InputStream r) throws IOException {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   216
            StringBuilder b = new StringBuilder();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   217
            int c;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   218
            while ((c = r.read()) != -1) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   219
                if (c == '\n') break;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   220
                b.appendCodePoint(c);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   221
            }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   222
            if (b.codePointAt(b.length() -1) == '\r') {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   223
                b.delete(b.length() -1, b.length());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   224
            }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   225
            return b.toString();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   226
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   227
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   228
        public void accept() {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   229
            Socket clientConnection = null;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   230
            try {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   231
                while (true) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   232
                    System.out.println("Tunnel: Waiting for client");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   233
                    Socket previous = clientConnection;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   234
                    try {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   235
                        clientConnection = ss.accept();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   236
                    } catch (IOException io) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   237
                        if (DEBUG) io.printStackTrace(System.out);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   238
                        break;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   239
                    } finally {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   240
                        // we have only 1 client at a time, so it is safe
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   241
                        // to close the previous connection here
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   242
                        if (previous != null) previous.close();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   243
                    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   244
                    System.out.println("Tunnel: Client accepted");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   245
                    Socket targetConnection = null;
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   246
                    InputStream  ccis = clientConnection.getInputStream();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   247
                    OutputStream ccos = clientConnection.getOutputStream();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   248
                    Writer w = new OutputStreamWriter(ccos, "UTF-8");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   249
                    PrintWriter pw = new PrintWriter(w);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   250
                    System.out.println("Tunnel: Reading request line");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   251
                    String requestLine = readLine(ccis);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   252
                    System.out.println("Tunnel: Request status line: " + requestLine);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   253
                    if (requestLine.startsWith("CONNECT ")) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   254
                        // We should probably check that the next word following
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   255
                        // CONNECT is the host:port of our HTTPS serverImpl.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   256
                        // Some improvement for a followup!
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   257
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   258
                        // Read all headers until we find the empty line that
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   259
                        // signals the end of all headers.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   260
                        while(!requestLine.equals("")) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   261
                            System.out.println("Tunnel: Reading header: "
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   262
                                               + (requestLine = readLine(ccis)));
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   263
                        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   264
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   265
                        // Open target connection
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   266
                        targetConnection = new Socket(
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   267
                                serverImpl.getAddress().getAddress(),
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   268
                                serverImpl.getAddress().getPort());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   269
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   270
                        // Then send the 200 OK response to the client
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   271
                        System.out.println("Tunnel: Sending "
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   272
                                           + "HTTP/1.1 200 OK\r\n\r\n");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   273
                        pw.print("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   274
                        pw.flush();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   275
                    } else {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   276
                        // This should not happen.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   277
                        throw new IOException("Tunnel: Unexpected status line: "
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   278
                                           + requestLine);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   279
                    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   280
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   281
                    // Pipe the input stream of the client connection to the
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   282
                    // output stream of the target connection and conversely.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   283
                    // Now the client and target will just talk to each other.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   284
                    System.out.println("Tunnel: Starting tunnel pipes");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   285
                    Thread t1 = pipe(ccis, targetConnection.getOutputStream(), '+');
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   286
                    Thread t2 = pipe(targetConnection.getInputStream(), ccos, '-');
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   287
                    t1.start();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   288
                    t2.start();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   289
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   290
                    // We have only 1 client... wait until it has finished before
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   291
                    // accepting a new connection request.
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   292
                    // System.out.println("Tunnel: Waiting for pipes to close");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   293
                    t1.join();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   294
                    t2.join();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   295
                    System.out.println("Tunnel: Done - waiting for next client");
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   296
                }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   297
            } catch (Throwable ex) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   298
                try {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   299
                    ss.close();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   300
                } catch (IOException ex1) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   301
                    ex.addSuppressed(ex1);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   302
                }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   303
                ex.printStackTrace(System.err);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   304
            }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   305
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   306
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   307
        void stop() throws IOException {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   308
            ss.close();
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   309
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   310
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   311
    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   312
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   313
    static class Configurator extends HttpsConfigurator {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   314
        public Configurator(SSLContext ctx) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   315
            super(ctx);
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   316
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   317
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   318
        @Override
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   319
        public void configure (HttpsParameters params) {
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   320
            params.setSSLParameters (getSSLContext().getSupportedSSLParameters());
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   321
        }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   322
    }
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   323
f3c2dcb8d8fe 8181422: ClassCastException in HTTP Client
dfuchs
parents:
diff changeset
   324
}