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));
}
}
}