/**
     * Sends get request and receives response using BlockingSenderDestination
     *
     * @see Thread#run()
     */
    public void run() {
      BlockingSenderDestination blockSendDest = null;
      try {
        blockSendDest =
            (BlockingSenderDestination)
                DestinationFactory.getSenderDestination(_context.getName(), URI.create(_uriStr));
        if (blockSendDest == null) {
          blockSendDest =
              DestinationFactory.createBlockingSenderDestination(_context, URI.create(_uriStr));
        }

        // Send message and wait for response
        _response = blockSendDest.sendReceive();

        if (_response != null) {
          _completed = true;

          // For "http"
          final String alertString =
              "received Message [id:"
                  + _response.getMessageId()
                  + "]\n"
                  + "Response Code: "
                  + ((HttpMessage) _response).getResponseCode();
          alertDialog(alertString);
        }
      } catch (final Exception e) {
        _completed = true;
        alertDialog(e.toString());
      } finally {
        if (blockSendDest != null) {
          blockSendDest.release();
        }
      }
    }
    /** @see MessageListener#onMessage(Destination, Message) */
    public void onMessage(final Destination destination, final Message message) {
      String alertString = _name + " :RECEIVED[id: " + message.getMessageId() + "]:";

      // Read payload
      if (message instanceof ByteMessage) {
        final String stringPayload = ((ByteMessage) message).getStringPayload();
        if (stringPayload != null) {
          alertString += "\n" + stringPayload;
        }
      }

      alertDialog(alertString);
    }
    /** @see MessageListener#onMessage(Destination, Message) */
    public void onMessage(final Destination destination, final Message message) {
      _response = message;
      _onMessage = true;

      if (_alertOnMessage) {
        String alertString = _name + " :RECEIVED[id: " + message.getMessageId() + "]:";

        final String stringPayload = ((ByteMessage) message).getStringPayload();
        if (stringPayload != null) {
          alertString += "\n" + stringPayload;
        }
        alertDialog(alertString);
      }
    }
    /** @see Thread#run() */
    public void run() {
      BlockingReceiverDestination blockRecvDest = null;
      try {
        blockRecvDest =
            (BlockingReceiverDestination)
                DestinationFactory.getReceiverDestination(URI.create(_uriStr));

        if (blockRecvDest == null) // Not registered yet
        {
          InboundDestinationConfiguration config;

          // Prepare the inbound destination for incoming messages
          if (_configType == InboundDestinationConfiguration.CONFIG_TYPE_BES) {
            config =
                InboundDestinationConfigurationFactory.createBESConfiguration(
                    _autoStartEnabled, true, false);
          } else if (_configType == InboundDestinationConfiguration.CONFIG_TYPE_IPC) {
            config =
                InboundDestinationConfigurationFactory.createIPCConfiguration(
                    _autoStartEnabled, true, false);
          } else {
            throw new IllegalArgumentException(
                "Invalid InboundDestinationConfiguration type! Implemented support of IPC and BES only.");
          }

          blockRecvDest =
              DestinationFactory.createBlockingReceiverDestination(config, URI.create(_uriStr));
        }

        String alertString = "";
        _response = blockRecvDest.receive(_timeout * 1000);

        if (_response != null) {
          alertString = "RECEIVED[id: " + _response.getMessageId() + "]:";
          final String stringPayload = ((ByteMessage) _response).getStringPayload();
          if (stringPayload != null) {
            alertString += "\n" + stringPayload;
          }
        } else {
          // No response received
          alertString = "No message has been received during timeout of " + _timeout + " sec.";
        }

        alertDialog(alertString);
      } catch (final Exception e) {
        alertDialog(e.toString());
      }
    }