• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SMPPSession类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jsmpp.session.SMPPSession的典型用法代码示例。如果您正苦于以下问题:Java SMPPSession类的具体用法?Java SMPPSession怎么用?Java SMPPSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SMPPSession类属于org.jsmpp.session包,在下文中一共展示了SMPPSession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createSession

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:SmppProducer.java


示例2: onAcceptDataSmSuccess

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Test
public void onAcceptDataSmSuccess() throws Exception {
    SMPPSession session = createMock(SMPPSession.class);
    DataSm dataSm = createMock(DataSm.class);
    Exchange exchange = createMock(Exchange.class);
    OptionalParameter[] optionalParameters = new OptionalParameter[]{};
    
    expect(endpoint.createOnAcceptDataSm(dataSm, "1"))
        .andReturn(exchange);
    processor.process(exchange);
    expect(exchange.getException()).andReturn(null);
    expect(dataSm.getOptionalParameters())
        .andReturn(optionalParameters);
    
    replay(endpoint, processor, exceptionHandler, session, dataSm, exchange);
    
    DataSmResult result = listener.onAcceptDataSm(dataSm, session);
    
    verify(endpoint, processor, exceptionHandler, session, dataSm, exchange);
    
    assertEquals("1", result.getMessageId());
    assertSame(optionalParameters, result.getOptionalParameters());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:MessageReceiverListenerImplTest.java


示例3: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    configuration = new SmppConfiguration();
    endpoint = createMock(SmppEndpoint.class);
    processor = createMock(Processor.class);
    session = createMock(SMPPSession.class);
    
    // the construction of SmppConsumer will trigger the getCamelContext call
    consumer = new SmppConsumer(
            endpoint, 
            configuration,
            processor) {
        
        SMPPSession createSMPPSession() {
            return session;
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:SmppConsumerTest.java


示例4: main

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
public static void main(String[] args) {
    SMPPSession session = new SMPPSession();
    try {
        session.connectAndBind("localhost", 8056, new BindParameter(BindType.BIND_TX, "test", "test", "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null));

        Random random = new Random();

        final int totalSegments = 3;
        OptionalParameter sarMsgRefNum = OptionalParameters.newSarMsgRefNum((short)random.nextInt());
        OptionalParameter sarTotalSegments = OptionalParameters.newSarTotalSegments(totalSegments);

        for (int i = 0; i < totalSegments; i++) {
            final int seqNum = i + 1;
            String message = "Message part " + seqNum + " of " + totalSegments + " ";
            OptionalParameter sarSegmentSeqnum = OptionalParameters.newSarSegmentSeqnum(seqNum);
            String messageId = submitMessage(session, message, sarMsgRefNum, sarSegmentSeqnum, sarTotalSegments);
            LOGGER.info("Message submitted, message_id is {}", messageId);
        }

        session.unbindAndClose();

    } catch (IOException e) {
        LOGGER.error("Failed connect and bind to host", e);
    }
}
 
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:26,代码来源:SubmitLongMessageExample.java


示例5: sendMessage

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
public void sendMessage() throws Exception
{
    final SMPPSession session = sessionPool.borrowObject();
    try
    {
        final String messageId = session.submitShortMessage(
            serviceType,
            sourceTon, sourceNpi, sourceAddress,
            destinationTon, destinationNpi, destinationAddress,
            esm, protocolId, priorityFlag,
            scheduleDeliveryTime, validityPeriod, registeredDelivery, replaceIfPresentFlag,
            dataCoding, smDefaultMsgId, message );
        Log.debug( "Message submitted, message_id is '{}'.", messageId );
    }
    finally
    {
        sessionPool.returnObject( session );
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:20,代码来源:SmsService.java


示例6: create

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Override
public SMPPSession create() throws Exception
{
    // SMSC connection settings
    final String host = JiveGlobals.getProperty( "sms.smpp.host", "localhost" );
    final int port = JiveGlobals.getIntProperty( "sms.smpp.port", 2775 );
    final String systemId = JiveGlobals.getProperty( "sms.smpp.systemId" );
    final String password = JiveGlobals.getProperty( "sms.smpp.password" );
    final String systemType = JiveGlobals.getProperty( "sms.smpp.systemType" );

    // Settings that apply to 'receiving' SMS. Should not apply to this implementation, as we're not receiving anything..
    final TypeOfNumber receiveTon = JiveGlobals.getEnumProperty( "sms.smpp.receive.ton", TypeOfNumber.class, TypeOfNumber.UNKNOWN );
    final NumberingPlanIndicator receiveNpi = JiveGlobals.getEnumProperty( "sms.smpp.receive.npi", NumberingPlanIndicator.class, NumberingPlanIndicator.UNKNOWN );

    Log.debug( "Creating a new sesssion (host: '{}', port: '{}', systemId: '{}'.", host, port, systemId );
    final SMPPSession session = new SMPPSession();
    session.connectAndBind( host, port, new BindParameter( BindType.BIND_TX, systemId, password, systemType, receiveTon, receiveNpi, null ) );
    Log.debug( "Created a new session with ID '{}'.", session.getSessionId() );
    return session;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:SmsService.java


示例7: start

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
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);
    }

}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:18,代码来源:SMPPImplManager.java


示例8: createSmppCommand

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
/**
 * Create the SmppCommand object from the inbound exchange
 *
 * @throws UnsupportedEncodingException if the encoding is not supported
 */
public SmppCommand createSmppCommand(SMPPSession session, Exchange exchange) {
    SmppCommandType commandType = SmppCommandType.fromExchange(exchange);
    SmppCommand command = commandType.createCommand(session, configuration);
    
    return command;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:SmppBinding.java


示例9: createSession

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
private SMPPSession createSession() throws IOException {
    SMPPSession session = createSMPPSession();
    session.setEnquireLinkTimer(configuration.getEnquireLinkTimer());
    session.setTransactionTimer(configuration.getTransactionTimer());
    session.addSessionStateListener(internalSessionStateListener);
    session.setMessageReceiverListener(messageReceiverListener);
    session.connectAndBind(this.configuration.getHost(), this.configuration.getPort(),
            new BindParameter(BindType.BIND_RX, this.configuration.getSystemId(),
                    this.configuration.getPassword(), this.configuration.getSystemType(),
                    TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN,
                              configuration.getAddressRange()));

    return session;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:SmppConsumer.java


示例10: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    session = createMock(SMPPSession.class);
    config = new SmppConfiguration();
    
    command = new SmppCancelSmCommand(session, config);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:SmppCancelSmCommandTest.java


示例11: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    session = createMock(SMPPSession.class);
    config = new SmppConfiguration();

    command = new SmppSubmitSmCommand(session, config);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:SmppSubmitSmCommandTest.java


示例12: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    session = createMock(SMPPSession.class);
    config = new SmppConfiguration();

    command = new SmppDataSmCommand(session, config);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:SmppDataSmCommandTest.java


示例13: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    configuration = new SmppConfiguration();
    configuration.setLazySessionCreation(true);
    endpoint = createMock(SmppEndpoint.class);
    session = createMock(SMPPSession.class);
    
    producer = new SmppProducer(endpoint, configuration) {
        SMPPSession createSMPPSession() {
            return session;
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:SmppProducerLazySessionCreationTest.java


示例14: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    configuration = new SmppConfiguration();
    endpoint = createMock(SmppEndpoint.class);
    session = createMock(SMPPSession.class);
    
    producer = new SmppProducer(endpoint, configuration) {
        SMPPSession createSMPPSession() {
            return session;
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:SmppProducerTest.java


示例15: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    session = createMock(SMPPSession.class);
    config = new SmppConfiguration();
    
    command = new SmppSubmitMultiCommand(session, config);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:SmppSubmitMultiCommandTest.java


示例16: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    session = new SMPPSession();
    config = new SmppConfiguration();
    
    command = new AbstractSmppCommand(session, config) {
        @Override
        public void execute(Exchange exchange) throws SmppException {
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:AbstractSmppCommandTest.java


示例17: setUp

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Before
public void setUp() {
    session = createMock(SMPPSession.class);
    config = new SmppConfiguration();
    
    command = new SmppQuerySmCommand(session, config);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:SmppQuerySmCommandTest.java


示例18: createSmppSubmitSmCommand

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Test
public void createSmppSubmitSmCommand() {
    SMPPSession session = new SMPPSession();
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    
    SmppCommand command = binding.createSmppCommand(session, exchange);
    
    assertTrue(command instanceof SmppSubmitSmCommand);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:SmppBindingTest.java


示例19: createSmppSubmitMultiCommand

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Test
public void createSmppSubmitMultiCommand() {
    SMPPSession session = new SMPPSession();
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitMulti");
    
    SmppCommand command = binding.createSmppCommand(session, exchange);
    
    assertTrue(command instanceof SmppSubmitMultiCommand);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:SmppBindingTest.java


示例20: createSmppDataSmCommand

import org.jsmpp.session.SMPPSession; //导入依赖的package包/类
@Test
public void createSmppDataSmCommand() {
    SMPPSession session = new SMPPSession();
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");
    
    SmppCommand command = binding.createSmppCommand(session, exchange);
    
    assertTrue(command instanceof SmppDataSmCommand);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:SmppBindingTest.java



注:本文中的org.jsmpp.session.SMPPSession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StorageClient1类代码示例发布时间:2022-05-23
下一篇:
Java IParserEditStatus类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap