?? smgpsmproxydemo.java
字號:
package demo.smgpdemo ;
import com.huawei.smproxy.comm.smgp.message.* ;
import com.huawei.smproxy.util.Args ;
import com.huawei.smproxy.util.Cfg ;
/**
* SMGP協(xié)議測試代碼
*/
public class SMGPSMProxyDemo
{
public SMGPSMProxyDemo ()
{
}
public static void main ( String[] args )
{
try
{
Args cfgArgs = new Cfg ( "config.xml" ).getArgs ( "SMGPConnect" ) ;
//可以在程序中重新指定配置參數(shù)的值,也可以就使用配置文件中的值
//cfgArgs.set("clientid","sp");
//cfgArgs.set("shared-secret","new");
MySMGPSMProxy mySMProxy = new MySMGPSMProxy ( cfgArgs ) ;
//構(gòu)造submit消息
String[] rcvMobile = new String[2] ;
rcvMobile[0] = "13388800001" ;
rcvMobile[1] = "13300000002" ;
SMGPSubmitMessage msg = new SMGPSubmitMessage (
9 ,
1 ,
9 ,
"goodnews13" ,
"01" ,
"999" ,
"" ,
8,
// new java.util.Date ( System.currentTimeMillis ()
// + 2 * 24 * 60 * 60 * 1000 ) ,
// new java.util.Date ( System.currentTimeMillis ()
// + 2 * 24 * 60 * 60 * 1000 ) ,
"060429101215032+",
"060429201215032+",
"13912345678" ,
"" ,
rcvMobile ,
"this isa test^&*%*發(fā)送消息,中國人好樣的" ,
"0123" ) ;
//發(fā)送消息
SMGPSubmitRespMessage respMsg = ( SMGPSubmitRespMessage ) mySMProxy.
send ( msg ) ;
if ( respMsg != null )
{
System.out.println (
"Get SubmitResp Message Success! The status = "
+ respMsg.getStatus () ) ;
}
else
{
System.out.println ( "Get SubmitResp Message Fail!" ) ;
}
//--------查詢消息----------
//--------轉(zhuǎn)發(fā)消息----------
//--------MO Route Update Message----------
//--------MT Route Update Message----------
try
{
Thread.sleep ( 600000 ) ;
}
catch ( InterruptedException ie )
{
ie.toString () ;
}
//關(guān)閉連接
mySMProxy.close () ;
}
catch ( Exception e )
{
e.printStackTrace () ;
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -