Source:
<code>private static IoFuture<Connection> connect(final CallbackHandler handler, final ProtocolConnectionConfiguration configuration) throws IOException { configuration.validate(); final Endpoint endpoint = configuration.getEndpoint(); final OptionMap options = getOptions(configuration); final CallbackHandler actualHandler = handler != null ? handler : new AnonymousCallbackHandler(); final SSLContext sslContext = configuration.getSslContext(); final URI uri = configuration.getUri(); String clientBindAddress = configuration.getClientBindAddress(); AuthenticationContext captured = AuthenticationContext.captureCurrent(); AuthenticationConfiguration mergedConfiguration = AUTH_CONFIGURATION_CLIENT.getAuthenticationConfiguration(uri, captured); if (actualHandler != null) mergedConfiguration = mergedConfiguration.useCallbackHandler(actualHandler); if (sslContext != null) mergedConfiguration = mergedConfiguration.useSslContext(sslContext); final AuthenticationContext context = AuthenticationContext.empty().with(MatchRule.ALL, mergedConfiguration); if (clientBindAddress == null) { try { return AccessController.doPrivileged((PrivilegedExceptionAction<IoFuture<Connection>>) () -> endpoint.connect(uri, options, context)); } catch (PrivilegedActionException pae) { <START> ProtocolLogger.CONNECTION_LOGGER.connectionPrivilegedAccessError(uri, pae); <END> try { throw pae.getCause(); } catch (IOException | RuntimeException | Error e) { throw e; } catch (Throwable t) { throw new UndeclaredThrowableException(t); } } } else { try { return AccessController.doPrivileged((PrivilegedExceptionAction<IoFuture<Connection>>) () -> { InetSocketAddress bindAddr = new InetSocketAddress(clientBindAddress, 0); return endpoint.connect(configuration.getUri(), options, context); }); } catch (PrivilegedActionException pae) { ProtocolLogger.CONNECTION_LOGGER.connectionPrivilegedAccessError(configuration.getUri(), pae); try { throw pae.getCause(); } catch (IOException | RuntimeException | Error e) { throw e; } catch (Throwable t) { throw new UndeclaredThrowableException(t); } } } }</code><technical_language>log *and* rethrow exceptions adds undue noise exception bubbles again. PAE add useful information discard completely throw cause</technical_language>

Target:
private static IoFuture<Connection> connect(final CallbackHandler handler, final ProtocolConnectionConfiguration configuration) throws IOException { configuration.validate(); final Endpoint endpoint = configuration.getEndpoint(); final OptionMap options = getOptions(configuration); final CallbackHandler actualHandler = handler != null ? handler : new AnonymousCallbackHandler(); final SSLContext sslContext = configuration.getSslContext(); final URI uri = configuration.getUri(); String clientBindAddress = configuration.getClientBindAddress(); AuthenticationContext captured = AuthenticationContext.captureCurrent(); AuthenticationConfiguration mergedConfiguration = AUTH_CONFIGURATION_CLIENT.getAuthenticationConfiguration(uri, captured); if (actualHandler != null) mergedConfiguration = mergedConfiguration.useCallbackHandler(actualHandler); if (sslContext != null) mergedConfiguration = mergedConfiguration.useSslContext(sslContext); final AuthenticationContext context = AuthenticationContext.empty().with(MatchRule.ALL, mergedConfiguration); if (clientBindAddress == null) { try { return AccessController.doPrivileged((PrivilegedExceptionAction<IoFuture<Connection>>) () -> endpoint.connect(uri, options, context)); } catch (PrivilegedActionException pae) { try { throw pae.getCause(); } catch (IOException | RuntimeException | Error e) { throw e; } catch (Throwable t) { throw new UndeclaredThrowableException(t); } } } else { try { return AccessController.doPrivileged((PrivilegedExceptionAction<IoFuture<Connection>>) () -> { InetSocketAddress bindAddr = new InetSocketAddress(clientBindAddress, 0); return endpoint.connect(configuration.getUri(), options, context); }); } catch (PrivilegedActionException pae) { try { throw pae.getCause(); } catch (IOException | RuntimeException | Error e) { throw e; } catch (Throwable t) { throw new UndeclaredThrowableException(t); } } } }