|
32 | 32 | import org.junit.experimental.theories.Theory;
|
33 | 33 | import org.junit.runner.RunWith;
|
34 | 34 | import software.amazon.awssdk.crt.CrtResource;
|
35 |
| -import software.amazon.awssdk.crt.io.ClientBootstrap; |
36 |
| -import software.amazon.awssdk.crt.io.SocketOptions; |
37 |
| -import software.amazon.awssdk.crt.io.TlsContext; |
38 |
| -import software.amazon.awssdk.crt.io.TlsContextOptions; |
39 | 35 | import software.amazon.awssdk.http.SdkHttpConfigurationOption;
|
40 | 36 | import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
|
41 | 37 | import software.amazon.awssdk.regions.Region;
|
|
45 | 41 | import software.amazon.awssdk.utils.AttributeMap;
|
46 | 42 |
|
47 | 43 | @RunWith(Theories.class)
|
48 |
| -public class AwsCrtCombinatorialConfigStressIntegrationTest { |
| 44 | +public class AwsCrtCombinatorialConfigStressIntegrationTest { |
49 | 45 | private final static String KEY_ALIAS = "alias/aws-sdk-java-v2-integ-test";
|
50 | 46 | private final static Region REGION = Region.US_EAST_1;
|
51 |
| - private final static List<SdkAsyncHttpClient> awsCrtHttpClients = new ArrayList<>(); |
52 | 47 | private final static int DEFAULT_KEY_SIZE = 32;
|
53 | 48 |
|
54 | 49 | // Success rate will currently never go above ~99% due to aws-c-http not detecting connection close headers, and KMS
|
@@ -98,26 +93,16 @@ private boolean testWithClient(KmsAsyncClient asyncKMSClient, int numberOfReques
|
98 | 93 | }
|
99 | 94 |
|
100 | 95 | private boolean testWithNewClient(int eventLoopSize, int numberOfRequests) {
|
101 |
| - try (ClientBootstrap newBootstrap = new ClientBootstrap(eventLoopSize)) { |
102 |
| - try (SocketOptions newSocketOptions = new SocketOptions()) { |
103 |
| - try (TlsContextOptions newContextOptions = new TlsContextOptions()) { |
104 |
| - try (TlsContext newTlsContext = new TlsContext(newContextOptions)) { |
105 |
| - try (SdkAsyncHttpClient newAwsCrtHttpClient = AwsCrtAsyncHttpClient.builder() |
106 |
| - .bootstrap(newBootstrap) |
107 |
| - .socketOptions(newSocketOptions) |
108 |
| - .tlsContext(newTlsContext) |
109 |
| - .build()) { |
110 |
| - try (KmsAsyncClient newAsyncKMSClient = KmsAsyncClient.builder() |
111 |
| - .region(REGION) |
112 |
| - .httpClient(newAwsCrtHttpClient) |
113 |
| - .credentialsProvider(CREDENTIALS_PROVIDER_CHAIN) |
114 |
| - .build()) { |
115 |
| - boolean succeeded = testWithClient(newAsyncKMSClient, numberOfRequests); |
116 |
| - return succeeded; |
117 |
| - } |
118 |
| - } |
119 |
| - } |
120 |
| - } |
| 96 | + try (SdkAsyncHttpClient newAwsCrtHttpClient = AwsCrtAsyncHttpClient.builder() |
| 97 | + .eventLoopSize(eventLoopSize) |
| 98 | + .build()) { |
| 99 | + try (KmsAsyncClient newAsyncKMSClient = KmsAsyncClient.builder() |
| 100 | + .region(REGION) |
| 101 | + .httpClient(newAwsCrtHttpClient) |
| 102 | + .credentialsProvider(CREDENTIALS_PROVIDER_CHAIN) |
| 103 | + .build()) { |
| 104 | + boolean succeeded = testWithClient(newAsyncKMSClient, numberOfRequests); |
| 105 | + return succeeded; |
121 | 106 | }
|
122 | 107 | }
|
123 | 108 | }
|
@@ -172,13 +157,9 @@ public void checkAllCombinations(@FromDataPoints("EventLoop") int eventLoopSize,
|
172 | 157 | .put(SdkHttpConfigurationOption.MAX_CONNECTIONS, connectionPoolSize)
|
173 | 158 | .build();
|
174 | 159 |
|
175 |
| - ClientBootstrap bootstrap = new ClientBootstrap(eventLoopSize); |
176 |
| - SocketOptions socketOptions = new SocketOptions(); |
177 |
| - TlsContext tlsContext = new TlsContext(); |
| 160 | + |
178 | 161 | SdkAsyncHttpClient awsCrtHttpClient = AwsCrtAsyncHttpClient.builder()
|
179 |
| - .bootstrap(bootstrap) |
180 |
| - .socketOptions(socketOptions) |
181 |
| - .tlsContext(tlsContext) |
| 162 | + .eventLoopSize(eventLoopSize) |
182 | 163 | .buildWithDefaults(attributes);
|
183 | 164 |
|
184 | 165 | KmsAsyncClient sharedAsyncKMSClient = KmsAsyncClient.builder()
|
@@ -212,10 +193,6 @@ public void checkAllCombinations(@FromDataPoints("EventLoop") int eventLoopSize,
|
212 | 193 |
|
213 | 194 | sharedAsyncKMSClient.close();
|
214 | 195 | awsCrtHttpClient.close();
|
215 |
| - tlsContext.close(); |
216 |
| - socketOptions.close(); |
217 |
| - bootstrap.close(); |
218 |
| - |
219 | 196 | Assert.assertFalse(failed.get());
|
220 | 197 |
|
221 | 198 | if (CrtResource.getAllocatedNativeResourceCount() > 0) {
|
|
0 commit comments