test/jdk/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/AbstractSSLTubeTest.java
author chegar
Wed, 06 Dec 2017 19:07:16 +0000
branchhttp-client-branch
changeset 55972 3fe2ae6d97a4
parent 55970 261d4d2f77e2
child 55973 4d9b002587db
permissions -rw-r--r--
http-client-branch: remove trailing whitespace
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     1
/*
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     4
 *
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     8
 *
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    13
 * accompanied this code).
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    14
 *
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    18
 *
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    21
 * questions.
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    22
 */
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    23
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    24
package jdk.incubator.http;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    25
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    26
import jdk.incubator.http.internal.common.FlowTube;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    27
import jdk.incubator.http.internal.common.SSLTube;
55909
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
    28
import jdk.incubator.http.internal.common.Utils;
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    29
import org.testng.annotations.Test;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    30
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    31
import javax.net.ssl.KeyManagerFactory;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    32
import javax.net.ssl.SSLContext;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    33
import javax.net.ssl.SSLEngine;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    34
import javax.net.ssl.SSLParameters;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    35
import javax.net.ssl.TrustManagerFactory;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    36
import java.io.File;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    37
import java.io.FileInputStream;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    38
import java.io.IOException;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    39
import java.io.InputStream;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    40
import java.nio.ByteBuffer;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    41
import java.security.KeyManagementException;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    42
import java.security.KeyStore;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    43
import java.security.KeyStoreException;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    44
import java.security.NoSuchAlgorithmException;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    45
import java.security.UnrecoverableKeyException;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    46
import java.security.cert.CertificateException;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    47
import java.util.List;
55942
8d4770c22b63 http-client-barnch: fixed a few issues discovered while stress testing and a race condition in SSLFlowDelegate
dfuchs
parents: 55909
diff changeset
    48
import java.util.Random;
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    49
import java.util.StringTokenizer;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    50
import java.util.concurrent.CompletableFuture;
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    51
import java.util.concurrent.CountDownLatch;
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    52
import java.util.concurrent.ExecutorService;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    53
import java.util.concurrent.Flow;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    54
import java.util.concurrent.ForkJoinPool;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    55
import java.util.concurrent.SubmissionPublisher;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    56
import java.util.concurrent.atomic.AtomicLong;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    57
55968
11a97b370db0 http-client-branch: common random seed handling for whitebox tests
chegar
parents: 55947
diff changeset
    58
public class AbstractSSLTubeTest extends AbstractRandomTest {
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    59
55947
c4f314605d28 http-client-branch: split SSLTubeTest for better diagnosis
dfuchs
parents: 55942
diff changeset
    60
    public static final long COUNTER = 600;
c4f314605d28 http-client-branch: split SSLTubeTest for better diagnosis
dfuchs
parents: 55942
diff changeset
    61
    public static final int LONGS_PER_BUF = 800;
c4f314605d28 http-client-branch: split SSLTubeTest for better diagnosis
dfuchs
parents: 55942
diff changeset
    62
    public static final long TOTAL_LONGS = COUNTER * LONGS_PER_BUF;
55942
8d4770c22b63 http-client-barnch: fixed a few issues discovered while stress testing and a race condition in SSLFlowDelegate
dfuchs
parents: 55909
diff changeset
    63
    public static final ByteBuffer SENTINEL = ByteBuffer.allocate(0);
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    64
    // This is a hack to work around an issue with SubmissionPublisher.
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    65
    // SubmissionPublisher will call onComplete immediately without forwarding
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    66
    // remaining pending data if SubmissionPublisher.close() is called when
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    67
    // there is no demand. In other words, it doesn't wait for the subscriber
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    68
    // to pull all the data before calling onComplete.
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    69
    // We use a CountDownLatch to figure out when it is safe to call close().
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    70
    // This may cause the test to hang if data are buffered.
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    71
    protected final CountDownLatch allBytesReceived = new CountDownLatch(1);
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    72
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    73
55947
c4f314605d28 http-client-branch: split SSLTubeTest for better diagnosis
dfuchs
parents: 55942
diff changeset
    74
    protected static ByteBuffer getBuffer(long startingAt) {
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    75
        ByteBuffer buf = ByteBuffer.allocate(LONGS_PER_BUF * 8);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    76
        for (int j = 0; j < LONGS_PER_BUF; j++) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    77
            buf.putLong(startingAt++);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    78
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    79
        buf.flip();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    80
        return buf;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    81
    }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    82
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    83
    protected void run(FlowTube server,
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    84
                       ExecutorService sslExecutor,
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    85
                       CountDownLatch allBytesReceived) throws IOException {
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    86
        FlowTube client = new SSLTube(createSSLEngine(true),
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    87
                                      sslExecutor,
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    88
                                      server);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    89
        SubmissionPublisher<List<ByteBuffer>> p =
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    90
                new SubmissionPublisher<>(ForkJoinPool.commonPool(),
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    91
                                          Integer.MAX_VALUE);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    92
        FlowTube.TubePublisher begin = p::subscribe;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    93
        CompletableFuture<Void> completion = new CompletableFuture<>();
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
    94
        EndSubscriber end = new EndSubscriber(TOTAL_LONGS, completion, allBytesReceived);
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    95
        client.connectFlows(begin, end);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    96
        /* End of wiring */
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    97
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    98
        long count = 0;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
    99
        System.out.printf("Submitting %d buffer arrays\n", COUNTER);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   100
        System.out.printf("LoopCount should be %d\n", TOTAL_LONGS);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   101
        for (long i = 0; i < COUNTER; i++) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   102
            ByteBuffer b = getBuffer(count);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   103
            count += LONGS_PER_BUF;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   104
            p.submit(List.of(b));
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   105
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   106
        System.out.println("Finished submission. Waiting for loopback");
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   107
        completion.whenComplete((r,t) -> allBytesReceived.countDown());
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   108
        try {
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   109
            allBytesReceived.await();
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   110
        } catch (InterruptedException e) {
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   111
            throw new IOException(e);
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   112
        }
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   113
        p.close();
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   114
        System.out.println("All bytes received: calling publisher.close()");
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   115
        try {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   116
            completion.join();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   117
            System.out.println("OK");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   118
        } finally {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   119
            sslExecutor.shutdownNow();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   120
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   121
    }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   122
55947
c4f314605d28 http-client-branch: split SSLTubeTest for better diagnosis
dfuchs
parents: 55942
diff changeset
   123
    protected static void sleep(long millis) {
55909
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   124
        try {
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   125
            Thread.sleep(millis);
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   126
        } catch (InterruptedException e) {
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   127
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   128
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   129
    }
55942
8d4770c22b63 http-client-barnch: fixed a few issues discovered while stress testing and a race condition in SSLFlowDelegate
dfuchs
parents: 55909
diff changeset
   130
8d4770c22b63 http-client-barnch: fixed a few issues discovered while stress testing and a race condition in SSLFlowDelegate
dfuchs
parents: 55909
diff changeset
   131
    /**
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   132
     * The final subscriber which receives the decrypted looped-back data. Just
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   133
     * needs to compare the data with what was sent. The given CF is either
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   134
     * completed exceptionally with an error or normally on success.
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   135
     */
55947
c4f314605d28 http-client-branch: split SSLTubeTest for better diagnosis
dfuchs
parents: 55942
diff changeset
   136
    protected static class EndSubscriber implements FlowTube.TubeSubscriber {
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   137
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   138
        private static final int REQUEST_WINDOW = 13;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   139
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   140
        private final long nbytes;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   141
        private final AtomicLong counter = new AtomicLong();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   142
        private final CompletableFuture<?> completion;
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   143
        private final CountDownLatch allBytesReceived;
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   144
        private volatile Flow.Subscription subscription;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   145
        private long unfulfilled;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   146
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   147
        EndSubscriber(long nbytes, CompletableFuture<?> completion,
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   148
                      CountDownLatch allBytesReceived) {
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   149
            this.nbytes = nbytes;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   150
            this.completion = completion;
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   151
            this.allBytesReceived = allBytesReceived;
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   152
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   153
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   154
        @Override
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   155
        public void onSubscribe(Flow.Subscription subscription) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   156
            this.subscription = subscription;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   157
            unfulfilled = REQUEST_WINDOW;
55909
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   158
            System.out.println("EndSubscriber request " + REQUEST_WINDOW);
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   159
            subscription.request(REQUEST_WINDOW);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   160
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   161
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   162
        public static String info(List<ByteBuffer> i) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   163
            StringBuilder sb = new StringBuilder();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   164
            sb.append("size: ").append(Integer.toString(i.size()));
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   165
            int x = 0;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   166
            for (ByteBuffer b : i)
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   167
                x += b.remaining();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   168
            sb.append(" bytes: ").append(x);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   169
            return sb.toString();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   170
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   171
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   172
        @Override
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   173
        public void onNext(List<ByteBuffer> buffers) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   174
            if (--unfulfilled == (REQUEST_WINDOW / 2)) {
55909
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   175
                long req = REQUEST_WINDOW - unfulfilled;
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   176
                System.out.println("EndSubscriber request " + req);
55942
8d4770c22b63 http-client-barnch: fixed a few issues discovered while stress testing and a race condition in SSLFlowDelegate
dfuchs
parents: 55909
diff changeset
   177
                unfulfilled = REQUEST_WINDOW;
55909
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   178
                subscription.request(req);
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   179
            }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   180
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   181
            long currval = counter.get();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   182
            if (currval % 500 == 0) {
55942
8d4770c22b63 http-client-barnch: fixed a few issues discovered while stress testing and a race condition in SSLFlowDelegate
dfuchs
parents: 55909
diff changeset
   183
                System.out.println("EndSubscriber: " + currval);
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   184
            }
55909
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   185
            System.out.println("EndSubscriber onNext " + Utils.remaining(buffers));
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   186
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   187
            for (ByteBuffer buf : buffers) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   188
                while (buf.hasRemaining()) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   189
                    long n = buf.getLong();
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   190
                    if (currval > (TOTAL_LONGS - 50)) {
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   191
                        System.out.println("End: " + currval);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   192
                    }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   193
                    if (n != currval++) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   194
                        System.out.println("ERROR at " + n + " != " + (currval - 1));
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   195
                        completion.completeExceptionally(new RuntimeException("ERROR"));
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   196
                        subscription.cancel();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   197
                        return;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   198
                    }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   199
                }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   200
            }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   201
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   202
            counter.set(currval);
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   203
            if (currval >= TOTAL_LONGS) {
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   204
                allBytesReceived.countDown();
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   205
            }
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   206
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   207
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   208
        @Override
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   209
        public void onError(Throwable throwable) {
55909
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   210
            System.out.println("EndSubscriber onError " + throwable);
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   211
            completion.completeExceptionally(throwable);
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   212
            allBytesReceived.countDown();
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   213
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   214
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   215
        @Override
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   216
        public void onComplete() {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   217
            long n = counter.get();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   218
            if (n != nbytes) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   219
                System.out.printf("nbytes=%d n=%d\n", nbytes, n);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   220
                completion.completeExceptionally(new RuntimeException("ERROR AT END"));
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   221
            } else {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   222
                System.out.println("DONE OK");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   223
                completion.complete(null);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   224
            }
55970
261d4d2f77e2 http-client-branch: workaround issue with SubmissionPublisher::close in several tests
dfuchs
parents: 55968
diff changeset
   225
            allBytesReceived.countDown();
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   226
        }
55972
3fe2ae6d97a4 http-client-branch: remove trailing whitespace
chegar
parents: 55970
diff changeset
   227
55909
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   228
        @Override
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   229
        public String toString() {
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   230
            return "EndSubscriber";
583695a0ed6a http-client-branch: review comment: SSLTubeTest is ignored (and some associated fix and cleanup)
dfuchs
parents: 55763
diff changeset
   231
        }
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   232
    }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   233
55947
c4f314605d28 http-client-branch: split SSLTubeTest for better diagnosis
dfuchs
parents: 55942
diff changeset
   234
    protected static SSLEngine createSSLEngine(boolean client) throws IOException {
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   235
        SSLContext context = (new SimpleSSLContext()).get();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   236
        SSLEngine engine = context.createSSLEngine();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   237
        SSLParameters params = context.getSupportedSSLParameters();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   238
        params.setProtocols(new String[]{"TLSv1.2"}); // TODO: This is essential. Needs to be protocol impl
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   239
        if (client) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   240
            params.setApplicationProtocols(new String[]{"proto1", "proto2"}); // server will choose proto2
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   241
        } else {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   242
            params.setApplicationProtocols(new String[]{"proto2"}); // server will choose proto2
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   243
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   244
        engine.setSSLParameters(params);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   245
        engine.setUseClientMode(client);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   246
        return engine;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   247
    }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   248
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   249
    /**
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   250
     * Creates a simple usable SSLContext for SSLSocketFactory or a HttpsServer
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   251
     * using either a given keystore or a default one in the test tree.
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   252
     *
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   253
     * Using this class with a security manager requires the following
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   254
     * permissions to be granted:
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   255
     *
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   256
     * permission "java.util.PropertyPermission" "test.src.path", "read";
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   257
     * permission java.io.FilePermission "${test.src}/../../../../lib/testlibrary/jdk/testlibrary/testkeys",
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   258
     * "read"; The exact path above depends on the location of the test.
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   259
     */
55947
c4f314605d28 http-client-branch: split SSLTubeTest for better diagnosis
dfuchs
parents: 55942
diff changeset
   260
    protected static class SimpleSSLContext {
55763
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   261
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   262
        private final SSLContext ssl;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   263
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   264
        /**
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   265
         * Loads default keystore from SimpleSSLContext source directory
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   266
         */
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   267
        public SimpleSSLContext() throws IOException {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   268
            String paths = System.getProperty("test.src.path");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   269
            StringTokenizer st = new StringTokenizer(paths, File.pathSeparator);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   270
            boolean securityExceptions = false;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   271
            SSLContext sslContext = null;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   272
            while (st.hasMoreTokens()) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   273
                String path = st.nextToken();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   274
                try {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   275
                    File f = new File(path, "../../../../lib/testlibrary/jdk/testlibrary/testkeys");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   276
                    if (f.exists()) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   277
                        try (FileInputStream fis = new FileInputStream(f)) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   278
                            sslContext = init(fis);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   279
                            break;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   280
                        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   281
                    }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   282
                } catch (SecurityException e) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   283
                    // catch and ignore because permission only required
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   284
                    // for one entry on path (at most)
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   285
                    securityExceptions = true;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   286
                }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   287
            }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   288
            if (securityExceptions) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   289
                System.err.println("SecurityExceptions thrown on loading testkeys");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   290
            }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   291
            ssl = sslContext;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   292
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   293
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   294
        private SSLContext init(InputStream i) throws IOException {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   295
            try {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   296
                char[] passphrase = "passphrase".toCharArray();
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   297
                KeyStore ks = KeyStore.getInstance("JKS");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   298
                ks.load(i, passphrase);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   299
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   300
                KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   301
                kmf.init(ks, passphrase);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   302
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   303
                TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   304
                tmf.init(ks);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   305
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   306
                SSLContext ssl = SSLContext.getInstance("TLS");
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   307
                ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   308
                return ssl;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   309
            } catch (KeyManagementException | KeyStoreException |
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   310
                    UnrecoverableKeyException | CertificateException |
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   311
                    NoSuchAlgorithmException e) {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   312
                throw new RuntimeException(e.getMessage());
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   313
            }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   314
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   315
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   316
        public SSLContext get() {
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   317
            return ssl;
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   318
        }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   319
    }
634d8e14c172 http-client-branch: intial load from jdk10/sandbox
chegar
parents:
diff changeset
   320
}