Source:
<code>public void connect() throws ClientConnectionException { if (isOpen()) { return; } try (LockWrapper wrapper = new LockWrapper(this.lock)) { if (isOpen() && isInInit()) { getPostConnectCallback().await(policy.getRetryTimeOut(), policy.getTimeUnit()); } if (isOpen()) { return; } final FutureTask<SocketChannel> task = scheduleTask(new Retryable<>(() -> { InetAddress address = InetAddress.getByName(hostname); log.info("Connecting to " + address); final InetSocketAddress addr = new InetSocketAddress(address, port); final SocketChannel socketChannel = SocketChannel.open(); socketChannel.configureBlocking(false); socketChannel.connect(addr); return socketChannel; }, this.policy)); this.channel = task.get(); final long timeout = getTimeout(policy.getRetryTimeOut(), policy.getTimeUnit()); while (!this.channel.finishConnect()) { final FutureTask<SocketChannel> connectTask = scheduleTask(new Retryable<>(() -> { if (System.currentTimeMillis() >= timeout) { throw new ConnectException("Connection timeout"); } return null; }, this.policy)); connectTask.get(); } updateLastIncomingHeartbeat(); updateLastOutgoingHeartbeat(); if (!isOpen()) { throw new ClientConnectionException("Connection failed"); } this.closing.set(false); clean(); postConnect(getPostConnectCallback()); } catch (InterruptedException | ExecutionException e) { logException(log, "Exception during connection", e); <START> final String message = "Connection issue " + getRootCause(e).getMessage(); <END> scheduleClose(message); throw new ClientConnectionException(e); } catch (IOException e) { closeChannel(); throw new ClientConnectionException("Connection failed", e); } }</code><technical_language>Please ExceptionUtils.getRootCauseMessage() commons-lang</technical_language>

Target:
public void connect() throws ClientConnectionException { if (isOpen()) { return; } try (LockWrapper wrapper = new LockWrapper(this.lock)) { if (isOpen() && isInInit()) { getPostConnectCallback().await(policy.getRetryTimeOut(), policy.getTimeUnit()); } if (isOpen()) { return; } final FutureTask<SocketChannel> task = scheduleTask(new Retryable<>(() -> { InetAddress address = InetAddress.getByName(hostname); log.info("Connecting to " + address); final InetSocketAddress addr = new InetSocketAddress(address, port); final SocketChannel socketChannel = SocketChannel.open(); socketChannel.configureBlocking(false); socketChannel.connect(addr); return socketChannel; }, this.policy)); this.channel = task.get(); final long timeout = getTimeout(policy.getRetryTimeOut(), policy.getTimeUnit()); while (!this.channel.finishConnect()) { final FutureTask<SocketChannel> connectTask = scheduleTask(new Retryable<>(() -> { if (System.currentTimeMillis() >= timeout) { throw new ConnectException("Connection timeout"); } return null; }, this.policy)); connectTask.get(); } updateLastIncomingHeartbeat(); updateLastOutgoingHeartbeat(); if (!isOpen()) { throw new ClientConnectionException("Connection failed"); } this.closing.set(false); clean(); postConnect(getPostConnectCallback()); } catch (InterruptedException | ExecutionException e) { logException(log, "Exception during connection", e); final String message = "Connection issue " + ExceptionUtils.getRootCause(e).getMessage(); scheduleClose(message); throw new ClientConnectionException(e); } catch (IOException e) { closeChannel(); throw new ClientConnectionException("Connection failed", e); } }