7070import org .apache .hc .core5 .reactor .ssl .TransportSecurityLayer ;
7171import org .apache .hc .core5 .util .TimeValue ;
7272import org .apache .hc .core5 .util .Timeout ;
73+ import org .slf4j .Logger ;
74+ import org .slf4j .LoggerFactory ;
7375
7476class InternalH2ConnPool implements ModalCloseable {
7577
@@ -176,6 +178,7 @@ public void setValidateAfterInactivity(final TimeValue timeValue) {
176178
177179 static class SessionPool extends AbstractIOSessionPool <HttpRoute > {
178180
181+ private static final Logger LOG = LoggerFactory .getLogger (InternalH2ConnPool .class );
179182 private static final int MAX_TUNNEL_AUTH_ATTEMPTS = 3 ;
180183
181184 private final ConnectionInitiator connectionInitiator ;
@@ -284,6 +287,9 @@ private void completeConnection(
284287 }
285288 final NamedEndpoint targetEndpoint = route .getTargetName () != null ? route .getTargetName () : route .getTargetHost ();
286289 final HttpHost proxy = route .getProxyHost ();
290+ if (LOG .isDebugEnabled ()) {
291+ LOG .debug ("{} establishing H2 tunnel to {} via {}" , ioSession .getId (), targetEndpoint , proxy );
292+ }
287293 if (proxy != null && proxyHttpProcessor != null && proxyAuthStrategy != null && authenticator != null ) {
288294 establishTunnelWithAuth (route , ioSession , targetEndpoint , proxy , connectTimeout , callback );
289295 } else {
@@ -375,6 +381,10 @@ public void failed(final Exception ex) {
375381 proxyHttpProcessor .process (response , null , tunnelContext );
376382 final boolean retry = needAuthentication (proxyAuthExchange , proxy , response , tunnelContext );
377383 if (retry ) {
384+ if (LOG .isDebugEnabled ()) {
385+ LOG .debug ("{} tunnel auth challenge from {}; attempt {}/{}" ,
386+ ioSession .getId (), proxy , attemptCount , MAX_TUNNEL_AUTH_ATTEMPTS );
387+ }
378388 establishTunnelWithAuthAttempt (
379389 route ,
380390 ioSession ,
@@ -388,8 +398,6 @@ public void failed(final Exception ex) {
388398 } else {
389399 callback .failed (ex );
390400 }
391- } catch (final AuthenticationException | MalformedChallengeException authEx ) {
392- callback .failed (authEx );
393401 } catch (final Exception ioEx ) {
394402 callback .failed (ioEx );
395403 }
0 commit comments