Returns a {@link AddressedEnvelope} of the given message and message sender values.

@param message the message
@param sender the sender address
@param <M> message type
@param <A> sender type
@return the envelope
508569
public static <M, A extends InetSocketAddress> AddressedEnvelope<M, A> of(M message, A sender) {
        return new DefaultAddressedEnvelope<>(message, null, sender);
    }
534376
public static SMTPRequest mail(String sender) {
        if (sender == null) {
            sender = "";
        }
        return new SMTPRequestImpl(MAIL_COMMAND,  "<" + sender + ">", ':');
    }
1213529
public static int getIndicator(GeometryEnvelope envelope) {
		int indicator = 1;
		if (envelope.hasZ()) {
			indicator++;
		}
		if (envelope.hasM()) {
			indicator += 2;
		}
		return indicator;
	}
404454
protected Attachment getImageMessage(MessageEnvelope envelope) {
		if (envelope != null
				&& envelope.getMessage() != null
				&& envelope.getMessage().getAttachments() != null
				&& envelope.getMessage().getAttachments().get(0) != null
				&& envelope.getMessage().getAttachments().get(0).getType() == AttachmentType.IMAGE) {
			
		
			return envelope.getMessage().getAttachments().get(0);
		}
		return null;
	}
215294
protected Attachment getFileMessage(MessageEnvelope envelope) {
		if (envelope != null
				&& envelope.getMessage() != null
				&& envelope.getMessage().getAttachments() != null
				&& envelope.getMessage().getAttachments().get(0) != null
				&& envelope.getMessage().getAttachments().get(0).getType() == AttachmentType.FILE) {
			
		
			return envelope.getMessage().getAttachments().get(0);
		}
		return null;
	}
761200
public int handleMessage(BaseMessage message)
    {
        Map<String,Object> properties = new HashMap<String,Object>();
        String strMessageType =  (String)message.get(MessageConstants.MESSAGE_TYPE_PARAM);
        String strStartIndex = (String)message.get(START_INDEX_PARAM);
        String strEndIndex = (String)message.get(END_INDEX_PARAM);
        if (strMessageType != null)
            properties.put(MessageConstants.MESSAGE_TYPE_PARAM, strMessageType);
        if (strStartIndex != null)
            properties.put(START_INDEX_PARAM, strStartIndex);
        if (strEndIndex != null)
            properties.put(END_INDEX_PARAM, strEndIndex);
        Map<String,Object> propertiesHdr = null;
        if (message.getMessageHeader() != null)
            propertiesHdr = message.getMessageHeader().getProperties();
        if (propertiesHdr != null)
            properties.putAll(propertiesHdr); // Merge them to simplify access
        if (properties != null)
        {
            strMessageType =  (String)properties.get(MessageConstants.MESSAGE_TYPE_PARAM);
            try {
                int iMessageType = Integer.parseInt(strMessageType);
                if ((Constants.AFTER_ADD_TYPE == iMessageType)
                    || (Constants.AFTER_DELETE_TYPE == iMessageType)
                    || (Constants.AFTER_UPDATE_TYPE == iMessageType))
                {
                    SwingUtilities.invokeLater(new UpdateGridTable(properties));
                }
            } catch (NumberFormatException ex) {
                // Ignore
            }
        }
        return super.handleMessage(message);
    }
288529
@Override
    public void addRecipient(final javax.mail.Message.RecipientType type, final Address address) throws MessagingException {
        throw new IllegalWriteException("Mock messages are read-only");
    }
837648
protected byte[] getTransportPayload(AuditEventMessage msg)
	{
		if (msg == null) {
			return null;
		}
		
		byte[] msgBytes = msg.getSerializedMessage(false);
		if (EventUtils.isEmptyOrNull(msgBytes)) {
			return null;
		}
		
		// Format message with transport-specific headers
		StringBuilder sb = new StringBuilder();
		sb.append("<");
		sb.append(TRANSPORT_DEFAULT_PRIORITY);
		sb.append(">");
		
		sb.append(TimestampUtils.getBSDSyslogDate(msg.getDateTime()));
		sb.append(" ");
		sb.append(getSystemHostName());
		sb.append(" ");
		sb.append("<?xml version=\"1.0\" encoding=\"ASCII\"?>");
		sb.append(new String(msgBytes));

		return sb.toString().trim().getBytes();
	}
794087
public function sendMessage($recipient, $message, $notificationType = NotificationType::REGULAR, $messagingType = MessagingType::RESPONSE)
    {
        $message = $this->createMessage($message);
        $options = RequestOptionsFactory::createForMessage($recipient, $message, $notificationType, $messagingType);
        $response = $this->client->send('POST', '/me/messages', null, [], [], $options);
        $responseData = $this->decodeResponse($response);

        return new MessageResponse($responseData['recipient_id'], $responseData['message_id']);
    }
881794
protected LocationCoordinates getLocationMessage(MessageEnvelope envelope) {
		if (envelope != null
				&& envelope.getMessage() != null
				&& envelope.getMessage().getAttachments() != null
				&& envelope.getMessage().getAttachments().get(0) != null
				&& envelope.getMessage().getAttachments().get(0).getPayload() != null
				&& envelope.getMessage().getAttachments().get(0).getPayload() instanceof QuickReplyLocationPayload) {

			QuickReplyLocationPayload payload = (QuickReplyLocationPayload) envelope
					.getMessage().getAttachments().get(0).getPayload();

			return payload.getCoordinates();
		}
		return null;
	}
1046889
public Envelope toEnvelope() {
        Envelope env = new Envelope(getWest(), getEast(), getSouth(), getNorth());
        return env;
    }
61217
private static MessageInfo mapMessageInfo(MessageInfoType messageInfoType) {
        MessageInfo messageInfo = new MessageInfo();
        if (messageInfoType != null) {
            messageInfo.setFlowId(messageInfoType.getFlowId());
            messageInfo.setMessageId(messageInfoType.getMessageId());
            messageInfo.setOperationName(messageInfoType.getOperationName());
            messageInfo.setPortType(messageInfoType.getPorttype() == null
                ? "" : messageInfoType.getPorttype().toString());
            messageInfo.setTransportType(messageInfoType.getTransport());
        }
        return messageInfo;
    }
798712
public int sendMessageToTopic(@Observes @MessageEvent MessageToClient msg) {
		return topicsMessagesBroadcaster.sendMessageToTopic(msg, getPayload(msg));
	}
1011629
public CmsNotificationMessage sendSticky(Type type, String message) {

        CmsNotificationMessage notificationMessage = new CmsNotificationMessage(Mode.STICKY, type, message);
        m_messages.add(notificationMessage);
        if (hasWidget()) {
            m_widget.addMessage(notificationMessage);
        }
        return notificationMessage;
    }
303620
protected boolean isEqualEnvelope(Envelope a, Envelope b) {
        return a.getMessage().getClass() == b.getMessage().getClass();
    }
1047468
def _get_sender(self, sender):
        
        if isinstance(sender, tuple):
            return "%s <%s>" % sender, sender[0], sender[1]
        else:
            return sender, sender, sender
1371990
public void sendDeferred(final Type type, final String message) {

        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            /**
             * @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute()
             */
            public void execute() {

                send(type, message);
            }
        });

    }