@Override
    public void execute(Exchange exchange) throws SmppException {
        CancelSm cancelSm = createCancelSm(exchange);

        if (log.isDebugEnabled()) {
            log.debug("Canceling a short message for exchange id '{}' and message id '{}'",
                    exchange.getExchangeId(), cancelSm.getMessageId());
        }

        try {
            session.cancelShortMessage(
                    cancelSm.getServiceType(),
                    cancelSm.getMessageId(),
                    TypeOfNumber.valueOf(cancelSm.getSourceAddrTon()),
                    NumberingPlanIndicator.valueOf(cancelSm.getSourceAddrNpi()),
                    cancelSm.getSourceAddr(),
                    TypeOfNumber.valueOf(cancelSm.getDestAddrTon()),
                    NumberingPlanIndicator.valueOf(cancelSm.getDestAddrNpi()),
                    cancelSm.getDestinationAddress());
        } catch (Exception e) {
            throw new SmppException(e);
        }

        if (log.isDebugEnabled()) {
            log.debug("Cancel a short message for exchange id '{}' and message id '{}'",
                    exchange.getExchangeId(), cancelSm.getMessageId());
        }

        Message message = ExchangeHelper.getResultMessage(exchange);
        message.setHeader(SmppConstants.ID, cancelSm.getMessageId());
    }
@Test
    public void execute() throws Exception {
        Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
        exchange.getIn().setHeader(SmppConstants.COMMAND, "CancelSm");
        exchange.getIn().setHeader(SmppConstants.ID, "1");
        exchange.getIn().setHeader(SmppConstants.SERVICE_TYPE, "XXX");
        exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_TON, TypeOfNumber.NATIONAL.value());
        exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_NPI, NumberingPlanIndicator.NATIONAL.value());
        exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR, "1818");
        exchange.getIn().setHeader(SmppConstants.DEST_ADDR_TON, TypeOfNumber.INTERNATIONAL.value());
        exchange.getIn().setHeader(SmppConstants.DEST_ADDR_NPI, NumberingPlanIndicator.INTERNET.value());
        exchange.getIn().setHeader(SmppConstants.DEST_ADDR, "1919");

        command.execute(exchange);

        verify(session).cancelShortMessage("XXX", "1", TypeOfNumber.NATIONAL, NumberingPlanIndicator.NATIONAL, "1818",
                TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.INTERNET, "1919");

        assertEquals("1", exchange.getMessage().getHeader(SmppConstants.ID));
    }