public ConnectedChannel getChannel(@Nonnull DataNodeId dataNodeId) throws Exception {
    Objects.requireNonNull(dataNodeId, "dataNodeId param cannot be null");

    ConnectedChannel connectedChannel = operationRetryHandler.executeWithRetry(
        () -> connectionPool.checkOutConnection(dataNodeId.getHostname(), dataNodeId.getPortToConnectTo(),
            config.fileCopyHandlerConnectionTimeoutMs), "CheckOutConnection");
    if (null == connectedChannel) {
      throw new IllegalStateException("Failed to get a connection to " + dataNodeId.getHostname());
    }
    return connectedChannel;
  }
Get a connection to the target replica.
@param dataNodeId The {@link DataNodeId} that contains the information required to get the connection.
@return The {@link ConnectedChannel} to the target replica.
@throws ConnectionPoolTimeoutException
@throws IOException
@throws InterruptedException
ambry-file-transfer/src/main/java/com/github/ambry/filetransfer/workflow/BaseWorkFlow.java