MockMessageProducer messageProducer = new MockMessageProducer();
SmppServerConfiguration configuration = new SmppServerConfiguration();
configuration.addUser("test", "test");
SmppServerConnector connector = new SmppServerConnector(configuration);
injectResource(messageProducer, connector);
injectResource(buildConnectorContext("test"), connector);
connector.configure();
connector.doStart();
// open connection and bind
Connection connection = connect(4444);
bind(connection, Connection.TRANSMITTER, "test", "test", null);
SubmitSM submitSM = (SubmitSM) connection.newInstance(SMPPPacket.SUBMIT_SM);
submitSM.setDestination(new Address(0, 0, "573001111111"));
submitSM.setSource(new Address(0, 0, "3542"));
submitSM.setMessageText("This is a test");
SubmitSMResp response = (SubmitSMResp) connection.sendRequest(submitSM);
Assert.assertNotNull(response);
Assert.assertTrue(response.getMessageId() != null);
Assert.assertEquals(messageProducer.messageCount(), 1);
Message message = messageProducer.getMessage(0);
Assert.assertNotNull(message);
Assert.assertEquals(message.getProperty("to", String.class), "573001111111");
Assert.assertEquals(message.getProperty("from", String.class), "3542");
Assert.assertEquals(message.getProperty("text", String.class), "This is a test");
connection.unbind();
connection.closeLink();
connector.doStop();
}