code: public SendMessageResult sendMessage(SignalServiceAddress             recipient,
                                         Optional<UnidentifiedAccessPair> unidentifiedAccess,
                                         SignalServiceDataMessage         message)
        throws UntrustedIdentityException, IOException
    {
      byte[]            content   = createMessageContent(message);
      long              timestamp = message.getTimestamp();
      SendMessageResult result    = sendMessage(recipient, getTargetUnidentifiedAccess(unidentifiedAccess), timestamp, content, false);
  
      if ((result.getSuccess() != null && result.getSuccess().isNeedsSync()) || (unidentifiedAccess.isPresent() && isMultiDevice.get())) {
        byte[] syncMessage = createMultiDeviceSentTranscriptContent(content, Optional.of(recipient), timestamp, Collections.singletonList(result));
        sendMessage(localAddress, Optional.<UnidentifiedAccess>absent(), timestamp, syncMessage, false);
      }
  
      if (message.isEndSession()) {
        store.deleteAllSessions(recipient.getNumber());
  
        if (eventListener.isPresent()) {
          eventListener.get().onSecurityEvent(recipient);
        }
      }
  
      return result;
    }
docs: Send a message to a single recipient.
  
  @param recipient The message's destination.
  @param message The message.
  @throws UntrustedIdentityException
  @throws IOException