submit0.setSourceAddress(new Address((byte)0x03, (byte)0x00, "40404"));
submit0.setDestAddress(new Address((byte)0x01, (byte)0x01, "44555519205"));
submit0.setShortMessage(textBytes);
SubmitSmResp submitResp = session0.submit(submit0, 10000);
logger.info("Got messageId: {}", submitResp.getMessageId());
System.out.println("Press any key to send query #1");
System.in.read();
QuerySm query0 = new QuerySm();
query0.setMessageId(submitResp.getMessageId());
query0.setSourceAddress(new Address((byte)0x03, (byte)0x00, "40404"));
WindowFuture<Integer,PduRequest,PduResponse> future1 = session0.sendRequestPdu(query0, 10000, true);
while (!future1.isDone()) {}
QuerySmResp queryResp = (QuerySmResp)future1.getResponse();
System.out.println("Press any key to send cancel #1");
System.in.read();
CancelSm cancel0 = new CancelSm();
cancel0.setMessageId(submitResp.getMessageId());
cancel0.setSourceAddress(new Address((byte)0x03, (byte)0x00, "40404"));
cancel0.setDestAddress(new Address((byte)0x01, (byte)0x01, "44555519205"));
WindowFuture<Integer,PduRequest,PduResponse> future2 = session0.sendRequestPdu(cancel0, 10000, true);
while (!future2.isDone()) {}
CancelSmResp cancelResp = (CancelSmResp)future2.getResponse();