1010import java .net .HttpURLConnection ;
1111import java .net .SocketTimeoutException ;
1212import java .net .URI ;
13- import java .net .URL ;
13+ import java .net .URISyntaxException ;
1414import java .security .NoSuchAlgorithmException ;
1515import java .time .Duration ;
1616import java .time .temporal .ChronoUnit ;
@@ -344,7 +344,7 @@ private CompletionStage<Message> sendAsync8(final Message query, Executor execut
344344 return CompletableFuture .completedFuture (response );
345345 } catch (SocketTimeoutException e ) {
346346 return this .<Message >timeoutFailedFuture (query , e );
347- } catch (IOException e ) {
347+ } catch (IOException | URISyntaxException e ) {
348348 return this .<Message >failedFuture (e );
349349 } finally {
350350 permit .release ();
@@ -362,8 +362,8 @@ private static class SendAndGetMessageBytesResponse {
362362 }
363363
364364 private SendAndGetMessageBytesResponse sendAndGetMessageBytes (
365- String url , byte [] queryBytes , long startTime ) throws IOException {
366- HttpURLConnection conn = (HttpURLConnection ) new URL (url ).openConnection ();
365+ String url , byte [] queryBytes , long startTime ) throws IOException , URISyntaxException {
366+ HttpURLConnection conn = (HttpURLConnection ) new URI (url ). toURL ( ).openConnection ();
367367 if (conn instanceof HttpsURLConnection ) {
368368 ((HttpsURLConnection ) conn ).setSSLSocketFactory (sslSocketFactory );
369369 }
0 commit comments