injectResource(buildConnectorContext("test"), connector);
connector.configure();
connector.doStart();
// open connection and bind
Connection connection = connect(4444);
bind(connection, Connection.TRANSMITTER, "test", "test", null);
final SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmm");
final Date submitDate = sdf.parse("1201011023");
final Date doneDate = sdf.parse("1201011048");
// send deliver_sm
new Thread(new Runnable() {
@Override
public void run() {
Message message = new Message();
message.setProperty("isDLR", true);
message.setProperty("to", "1111");
message.setProperty("from", "2222");
message.setProperty("messageId", "12345");
message.setProperty("submitted", 1);
message.setProperty("submitDate", submitDate);
message.setProperty("delivered", 1);
message.setProperty("doneDate", doneDate);
message.setProperty("finalStatus", "DELIVRD");
try {
connector.process(message);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
SMPPPacket packet = connection.readNextPacket();
Assert.assertNotNull(packet);
Assert.assertEquals(packet.getCommandId(), SMPPPacket.DELIVER_SM);
DeliverSM deliverSm = (DeliverSM) packet;
Assert.assertEquals(deliverSm.getEsmClass(), (byte) 0x04);