コード例 #1
0
 public void sendMessage(DiameterMessage message) throws IOException {
   try {
     if (message instanceof DiameterMessageImpl) {
       DiameterMessageImpl msg = (DiameterMessageImpl) message;
       this.session.send(msg.getGenericData(), this.eventListener);
     } else {
       throw new OperationNotSupportedException(
           "Trying to send wrong type of message? [" + message.getClass() + "] \n" + message);
     }
   } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
     throw new AvpNotAllowedException(
         "Message validation failed.", e, e.getAvpCode(), e.getVendorId());
   } catch (Exception e) {
     throw new IOException("Failed to send message, due to: " + e);
   }
 }
コード例 #2
0
  protected Message doSendMessage(DiameterMessage message) {
    Message receivedMessage = null;
    try {
      if (message instanceof DiameterMessageImpl) {
        Future<Message> future =
            this.session.send(((DiameterMessageImpl) message).getGenericData());

        receivedMessage = future.get();
      } else {
        throw new OperationNotSupportedException(
            "Trying to send wrong type of message? [" + message.getClass() + "] \n" + message);
      }
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
      throw new AvpNotAllowedException(
          "Message validation failed.", e, e.getAvpCode(), e.getVendorId());
    } catch (Exception e) {
      logger.error("Failure sending sync request.", e);
    }

    return receivedMessage;
  }