Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 887b3cd

Browse files
committedOct 12, 2023
use Apache HTTP client
1 parent a4923d4 commit 887b3cd

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed
 

‎common/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</dependency>
7777
<dependency>
7878
<groupId>software.amazon.awssdk</groupId>
79-
<artifactId>url-connection-client</artifactId>
79+
<artifactId>apache-client</artifactId>
8080
</dependency>
8181
<dependency>
8282
<groupId>org.apache.avro</groupId>

‎common/src/main/java/com/amazonaws/services/schemaregistry/common/AWSSchemaRegistryClient.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import software.amazon.awssdk.core.interceptor.ExecutionAttributes;
3232
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;
3333
import software.amazon.awssdk.core.retry.RetryPolicy;
34-
import software.amazon.awssdk.http.urlconnection.ProxyConfiguration;
35-
import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
34+
import software.amazon.awssdk.http.apache.ApacheHttpClient;
35+
import software.amazon.awssdk.http.apache.ProxyConfiguration;
3636
import software.amazon.awssdk.regions.Region;
3737
import software.amazon.awssdk.services.glue.GlueClient;
3838
import software.amazon.awssdk.services.glue.GlueClientBuilder;
@@ -90,25 +90,25 @@ public AWSSchemaRegistryClient(@NonNull AwsCredentialsProvider credentialsProvid
9090
.retryPolicy(retryPolicy)
9191
.addExecutionInterceptor(new UserAgentRequestInterceptor())
9292
.build();
93-
UrlConnectionHttpClient.Builder urlConnectionHttpClientBuilder = UrlConnectionHttpClient.builder();
93+
ApacheHttpClient.Builder httpClientBuilder = ApacheHttpClient.builder();
9494
if (glueSchemaRegistryConfiguration.getProxyUrl() != null) {
95-
log.debug("Creating http client using proxy {}", glueSchemaRegistryConfiguration.getProxyUrl().toString());
95+
log.debug("Creating http client using proxy {}", glueSchemaRegistryConfiguration.getProxyUrl());
9696
ProxyConfiguration proxy = ProxyConfiguration.builder().endpoint(glueSchemaRegistryConfiguration.getProxyUrl()).build();
97-
urlConnectionHttpClientBuilder.proxyConfiguration(proxy);
97+
httpClientBuilder.proxyConfiguration(proxy);
9898
}
9999

100100
GlueClientBuilder glueClientBuilder = GlueClient
101101
.builder()
102102
.credentialsProvider(credentialsProvider)
103103
.overrideConfiguration(overrideConfiguration)
104-
.httpClient(urlConnectionHttpClientBuilder.build())
104+
.httpClient(httpClientBuilder.build())
105105
.region(Region.of(glueSchemaRegistryConfiguration.getRegion()));
106106

107107
if (glueSchemaRegistryConfiguration.getEndPoint() != null) {
108108
try {
109109
glueClientBuilder.endpointOverride(new URI(glueSchemaRegistryConfiguration.getEndPoint()));
110110
} catch (URISyntaxException e) {
111-
String message = String.format("Malformed uri, please pass the valid uri for creating the client",
111+
String message = String.format("Malformed uri, please pass the valid uri for creating the client: %s",
112112
glueSchemaRegistryConfiguration.getEndPoint());
113113
throw new AWSSchemaRegistryException(message, e);
114114
}

‎common/src/test/java/com/amazonaws/services/schemaregistry/common/AWSSchemaRegistryClientTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public void testConstructor_withMalformedUri_throwsException() {
167167
() -> new AWSSchemaRegistryClient(mockAwsCredentialsProvider, glueSchemaRegistryConfiguration));
168168
assertEquals(URISyntaxException.class, awsSchemaRegistryException.getCause().getClass());
169169

170-
String expectedMessage = String.format("Malformed uri, please pass the valid uri for creating the client",
170+
String expectedMessage = String.format("Malformed uri, please pass the valid uri for creating the client: %s",
171171
glueSchemaRegistryConfiguration.getEndPoint());
172172
assertEquals(expectedMessage, awsSchemaRegistryException.getMessage());
173173
}

‎integration-tests/src/test/java/com/amazonaws/services/schemaregistry/integrationtests/kafka/GlueSchemaRegistryKafkaIntegrationTest.java

-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.junit.jupiter.params.provider.MethodSource;
4444
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
4545
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
46-
import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
4746
import software.amazon.awssdk.regions.Region;
4847
import software.amazon.awssdk.services.glue.GlueClient;
4948
import software.amazon.awssdk.services.glue.model.Compatibility;
@@ -116,8 +115,6 @@ public static void tearDown() throws URISyntaxException {
116115
.credentialsProvider(awsCredentialsProvider)
117116
.region(Region.of(REGION))
118117
.endpointOverride(new URI(SCHEMA_REGISTRY_ENDPOINT_OVERRIDE))
119-
.httpClient(UrlConnectionHttpClient.builder()
120-
.build())
121118
.build();
122119

123120
for (String schemaName : schemasToCleanUp) {

‎integration-tests/src/test/java/com/amazonaws/services/schemaregistry/integrationtests/kinesis/GlueSchemaRegistryKinesisIntegrationTest.java

-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
5858
import software.amazon.awssdk.core.SdkBytes;
5959
import software.amazon.awssdk.core.SdkSystemSetting;
60-
import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
6160
import software.amazon.awssdk.regions.Region;
6261
import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient;
6362
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient;
@@ -195,8 +194,6 @@ public static void tearDown() throws URISyntaxException {
195194
.credentialsProvider(awsCredentialsProvider)
196195
.region(Region.of(REGION))
197196
.endpointOverride(new URI(SCHEMA_REGISTRY_ENDPOINT_OVERRIDE))
198-
.httpClient(UrlConnectionHttpClient.builder()
199-
.build())
200197
.build();
201198

202199
for (String schemaName : schemasToCleanUp) {

0 commit comments

Comments
 (0)
Please sign in to comment.