if (getConfiguration() == null) {
throw new IllegalStateException("Configuration must be set");
}
ConnectFuture connectFuture = client.connect(null, getHost(), getPort());
// Wait getTimeout milliseconds for connect operation to complete
connectFuture.await(getTimeout());
if (!connectFuture.isDone() || !connectFuture.isConnected()) {
final String msg = "Failed to connect to " + getHost() + ":" + getPort() + " within timeout " + getTimeout() + "ms";
log.debug(msg);
throw new RuntimeCamelException(msg);
}
log.debug("Connected to {}:{}", getHost(), getPort());
ClientChannel channel = null;
ClientSession session = null;
try {
AuthFuture authResult;
session = connectFuture.getSession();
KeyPairProvider keyPairProvider;
final String certResource = getCertResource();
if (certResource != null) {
log.debug("Attempting to authenticate using ResourceKey '{}'...", certResource);