test/jdk/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/FlowTest.java
equal
deleted
inserted
replaced
56 import jdk.incubator.http.internal.common.Utils; |
56 import jdk.incubator.http.internal.common.Utils; |
57 import org.testng.annotations.Test; |
57 import org.testng.annotations.Test; |
58 import jdk.incubator.http.internal.common.SSLFlowDelegate; |
58 import jdk.incubator.http.internal.common.SSLFlowDelegate; |
59 |
59 |
60 @Test |
60 @Test |
61 public class FlowTest { |
61 public class FlowTest extends AbstractRandomTest { |
62 |
62 |
63 private final SubmissionPublisher<List<ByteBuffer>> srcPublisher; |
63 private final SubmissionPublisher<List<ByteBuffer>> srcPublisher; |
64 private final ExecutorService executor; |
64 private final ExecutorService executor; |
65 private static final long COUNTER = 3000; |
65 private static final long COUNTER = 3000; |
66 private static final int LONGS_PER_BUF = 800; |
66 private static final int LONGS_PER_BUF = 800; |
104 srcPublisher.subscribe(writer); |
104 srcPublisher.subscribe(writer); |
105 String aa = sslClient.alpn().join(); |
105 String aa = sslClient.alpn().join(); |
106 System.out.println("AAALPN = " + aa); |
106 System.out.println("AAALPN = " + aa); |
107 } |
107 } |
108 |
108 |
109 static Random rand = new Random(); |
|
110 |
|
111 static int randomRange(int lower, int upper) { |
|
112 if (lower > upper) |
|
113 throw new IllegalArgumentException("lower > upper"); |
|
114 int diff = upper - lower; |
|
115 int r = lower + rand.nextInt(diff); |
|
116 return r - (r % 8); // round down to multiple of 8 (align for longs) |
|
117 } |
|
118 |
|
119 private void handlePublisherException(Object o, Throwable t) { |
109 private void handlePublisherException(Object o, Throwable t) { |
120 System.out.println("Src Publisher exception"); |
110 System.out.println("Src Publisher exception"); |
121 t.printStackTrace(System.out); |
111 t.printStackTrace(System.out); |
122 } |
112 } |
123 |
113 |