Package ru.headhunter.smsengine

Source Code of ru.headhunter.smsengine.SMSEngineServiceWorkTest

package ru.headhunter.smsengine;

import java.util.List;

import ru.headhunter.smsengine.client.SMSEngine;
import ru.headhunter.smsengine.client.SmsMessage;

import com.caucho.hessian.client.HessianProxyFactory;

public class SMSEngineServiceWorkTest {

    public static void main(String[] args) throws Exception {
        HessianProxyFactory factory = new HessianProxyFactory();
        SMSEngine engine = (SMSEngine) factory.create(SMSEngine.class, "http://localhost:9292/sms-engine/service");
        try {
            engine.sendSMS("79053673205", "sms sending test");
            System.out.println("sms sent");
            engine.sendSMS("79053673205", "sms sending test");
            System.out.println("sms sent");
            engine.sendSMS("79053673205", "sms sending test");
            System.out.println("sms sent");
            engine.sendSMS("79053673205", "sms sending test");
            System.out.println("sms sent");
            engine.sendSMS("79053673205", "sms sending test");
            System.out.println("sms sent");
        } catch (Exception e) {
            System.out.println("send error");
        }

        List<SmsMessage> smsList = engine.getSmsMessages();
        for (SmsMessage smsMessage : smsList) {
            System.out.println("uid: [" + smsMessage.getUid() + "], receivedTime: [" + smsMessage.getReceiveTime() + "], number: ["
                    + smsMessage.getFromPhone() + "], message: [" + smsMessage.getMessageBody() + "]");
        }

        if (smsList != null && !smsList.isEmpty()) {
            engine.removeFromInQueue(smsList.get(0));
        }
    }

}
TOP

Related Classes of ru.headhunter.smsengine.SMSEngineServiceWorkTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.