Search in sources :

Example 6 with BindParameter

use of org.jsmpp.session.BindParameter in project wso2-axis2-transports by wso2.

the class SMPPImplManager method start.

public void start() {
    inSession = new SMPPSession();
    try {
        inSession.connectAndBind(smppTransportInDetails.getHost(), smppTransportInDetails.getPort(), new BindParameter(BindType.BIND_RX, smppTransportInDetails.getSystemId(), smppTransportInDetails.getPassword(), smppTransportInDetails.getSystemType(), TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null));
        SMPPListener listener = new SMPPListener(smsInManeger);
        inSession.setMessageReceiverListener(listener);
        stop = false;
        System.out.println(" [Axis2] bind and connect to " + smppTransportInDetails.getHost() + " : " + smppTransportInDetails.getPort() + " on SMPP Transport");
    } catch (IOException e) {
        log.error("Unable to conncet" + e);
    }
}
Also used : BindParameter(org.jsmpp.session.BindParameter) SMPPSession(org.jsmpp.session.SMPPSession) IOException(java.io.IOException)

Example 7 with BindParameter

use of org.jsmpp.session.BindParameter in project camel by apache.

the class SmppProducer method createSession.

private SMPPSession createSession() throws IOException {
    LOG.debug("Connecting to: {}...", getEndpoint().getConnectionString());
    SMPPSession session = createSMPPSession();
    session.setEnquireLinkTimer(this.configuration.getEnquireLinkTimer());
    session.setTransactionTimer(this.configuration.getTransactionTimer());
    session.addSessionStateListener(internalSessionStateListener);
    session.connectAndBind(this.configuration.getHost(), this.configuration.getPort(), new BindParameter(BindType.BIND_TX, this.configuration.getSystemId(), this.configuration.getPassword(), this.configuration.getSystemType(), TypeOfNumber.valueOf(configuration.getTypeOfNumber()), NumberingPlanIndicator.valueOf(configuration.getNumberingPlanIndicator()), ""));
    LOG.info("Connected to: {}", getEndpoint().getConnectionString());
    return session;
}
Also used : BindParameter(org.jsmpp.session.BindParameter) SMPPSession(org.jsmpp.session.SMPPSession)

Example 8 with BindParameter

use of org.jsmpp.session.BindParameter in project camel by apache.

the class SmppConsumerTest method addressRangeFromConfigurationIsUsed.

@Test
public void addressRangeFromConfigurationIsUsed() throws Exception {
    resetToNice(endpoint, session);
    configuration.setAddressRange("(111*|222*|333*)");
    expect(session.connectAndBind("localhost", new Integer(2775), new BindParameter(BindType.BIND_RX, "smppclient", "password", "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, "(111*|222*|333*)"))).andReturn("1");
    replay(endpoint, processor, session);
    consumer.doStart();
    verify(endpoint, processor, session);
}
Also used : BindParameter(org.jsmpp.session.BindParameter) Test(org.junit.Test)

Example 9 with BindParameter

use of org.jsmpp.session.BindParameter in project camel by apache.

the class SmppConsumerTest method doStartShouldStartANewSmppSession.

@Test
public void doStartShouldStartANewSmppSession() throws Exception {
    resetToNice(endpoint, session);
    expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775").times(2);
    //expectation
    session.setEnquireLinkTimer(5000);
    //expectation
    session.setTransactionTimer(10000);
    session.addSessionStateListener(isA(SessionStateListener.class));
    //expectation
    session.setMessageReceiverListener(isA(MessageReceiverListener.class));
    expect(session.connectAndBind("localhost", new Integer(2775), new BindParameter(BindType.BIND_RX, "smppclient", "password", "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, ""))).andReturn("1");
    expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775");
    replay(endpoint, processor, session);
    consumer.doStart();
    verify(endpoint, processor, session);
}
Also used : SessionStateListener(org.jsmpp.session.SessionStateListener) MessageReceiverListener(org.jsmpp.session.MessageReceiverListener) BindParameter(org.jsmpp.session.BindParameter) Test(org.junit.Test)

Aggregations

BindParameter (org.jsmpp.session.BindParameter)9 SMPPSession (org.jsmpp.session.SMPPSession)4 SessionStateListener (org.jsmpp.session.SessionStateListener)4 Test (org.junit.Test)4 IOException (java.io.IOException)2 Exchange (org.apache.camel.Exchange)2 Message (org.apache.camel.Message)2 Date (java.util.Date)1 AxisFault (org.apache.axis2.AxisFault)1 InvalidResponseException (org.jsmpp.InvalidResponseException)1 PDUException (org.jsmpp.PDUException)1 NegativeResponseException (org.jsmpp.extra.NegativeResponseException)1 ResponseTimeoutException (org.jsmpp.extra.ResponseTimeoutException)1 MessageReceiverListener (org.jsmpp.session.MessageReceiverListener)1