HybridEncryptedContent encryptedMessage = signAndEncryptMessage(message, targetPublicKey);
if (encryptedMessage == null)
return false;
// send message to the peer which is responsible for the given key
FutureSend futureSend = networkManager.getConnection().getPeer()
.send(Number160.createHash(message.getTargetKey())).setObject(encryptedMessage)
.setRequestP2PConfiguration(createSendingConfiguration()).start();
// attach a future listener to log, handle and notify events
FutureRoutedListener listener = new FutureRoutedListener(message, targetPublicKey, this);
futureSend.addListener(listener);
boolean success = listener.await();
if (success) {
logger.debug("Message sent. Target key = '{}', Message ID = '{}'.",
message.getTargetKey(), message.getMessageID());