/** {@inheritDoc} */
 @Override
 protected Address processIncomingMessage(Message janusMessage, boolean isBroadcast) {
   Class<? extends Role> receiverRole = null;
   Address adr = janusMessage.getSender();
   if (adr instanceof RoleAddress) {
     receiverRole = ((RoleAddress) janusMessage.getReceiver()).getRole();
     return JanusGroupJxtaGroup.this.networkHandler.receiveOrganizationalDistantMessage(
         JanusGroupJxtaGroup.this.janusGroupAddress, receiverRole, janusMessage, isBroadcast);
   }
   return JanusGroupJxtaGroup.this.networkHandler.receiveAgentAgentDistantMessage(
       janusMessage, isBroadcast);
 }
	private static net.jxta.endpoint.Message buildJxtaMessage(Message message, boolean isBroadcast) throws IOException {
		net.jxta.endpoint.Message msg = new net.jxta.endpoint.Message();
		if (isBroadcast) {
			MessageUtils.addStringToMessage(msg, MSG_NAMESPACE_SENDING, MSG_ELEM_COMM_TYPE, COMM_TYPE_BROADCAST);
		}
		else {
			if (message.getReceiver() == null) {
				MessageUtils.addStringToMessage(msg, MSG_NAMESPACE_SENDING, MSG_ELEM_COMM_TYPE, COMM_TYPE_DIRECT_RANDOM);
			}
			else {
				MessageUtils.addStringToMessage(msg, MSG_NAMESPACE_SENDING, MSG_ELEM_COMM_TYPE, COMM_TYPE_DIRECT_SPECIFIED);
			}
		}

		MessageUtils.addObjectToMessage(msg, MSG_NAMESPACE_SENDING, MSG_ELEM_OBJ, message);
		return msg;
	}