package org.phoenix.cases.plugin; import java.util.LinkedList; import org.phoenix.model.CaseLogBean; import org.phoenix.model.UnitLogBean; import org.phoenix.plugins.ITelnetClient; import org.phoenix.proxy.ActionProxy; /** * Telnet客戶端測試 * @author mengfeiyang * */ public class TelnetPluginTest extends ActionProxy{ @Override public LinkedList<UnitLogBean> run(CaseLogBean caseLogBean) { init(caseLogBean); //鏈接SocketServer ITelnetClient telnet = phoenix.telnetClient().configTelnetClient("localhost", 8889); String rs = telnet.sendCommand("!showorders", "datas");//向socketServer發送指令,若是返回值以datas結尾,則終止數據接收 System.out.println(rs); phoenix.checkPoint().checkIsNull(rs); String rs2 = telnet.sendCommand("!showusers", "]"); System.out.println(rs2); phoenix.checkPoint().checkIsNull(rs2); telnet.disconnect();//斷開本次的鏈接 return getUnitLog(); } public static void main(String[] args) { TelnetPluginTest p = new TelnetPluginTest(); LinkedList<UnitLogBean> ll = p.run(new CaseLogBean()); for(UnitLogBean l : ll){ System.out.println(l.getContent()); } } }