package org.tonjac.sms.test; import java.util.logging.Level; import java.util.logging.Logger; import org.tonjac.sms.SMSListener; import org.tonjac.sms.SMS; public class TestSMSListener implements SMSListener { private static Logger m_Log = Logger.getLogger(TestSMSListener.class.getName()); public void onMessage( String command, String[] args, String from ) throws Exception { m_Log.log( Level.INFO, "Received '" + command + "(\"" + args[0] + "\")' from " + from ); if( args[0].equalsIgnoreCase( "error" ) ) throw new Exception( "Error" ); // Send a reply to the sender SMS sms = new SMS( "Received '" + command + "' command, thank you!", from ); sms.send(); } }