可以啊,我以前试过的.我一直在dos环境下使用MSN
解决方案 »
- tomcat运行一段时间就报错
- Unable to find parent packages jfreechart-default
- jsp页面中 怎么通过el表达式获得集合中的值的总和
- 公司给我这个实习生新项目
- 2010特殊问题
- <img src="${base }${slist.salesmPicture}" >图片问题
- tomcat生成文件位置问题
- hibernate一对多问题
- 怎能样像迅雷看看哪样将一个层显示在屏幕中央
- tomcat中如何配置数据源(jndi)
- Servlet 可否有类似于系统进程的方式运行吗?
- 在线求解何错error:java.lang.ArithmeticException: / by zero
public class JMsnTest extends Thread {
private static MSNMessenger msn; public static void main(String[] args) {
msn = new MSNMessenger("[email protected]", "password");
msn.setInitialStatus(UserStatus.ONLINE);
msn.addMsnListener(new MSNAdapter(msn));
msn.login();
MimeMessage me = new MimeMessage("ok");
me.setKind(MimeMessage.KIND_MESSAGE);
try {
Thread.currentThread().sleep(1500);
msn.doCall("[email protected]");
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Waiting for the response....");
Runtime.getRuntime().addShutdownHook(new JMsnTest());
}
public void run() {
msn.logout();
System.out.println("MSN Logout OK");
}
}
class MSNAdapter extends MsnAdapter {
public void switchboardSessionStarted(SwitchboardSession switchboardsession) {
MimeMessage hello = new MimeMessage("hello");
hello.setKind(MimeMessage.KIND_MESSAGE);
try {
boolean sendok = messenger.sendMessage(hello,switchboardsession);
switchboardsession.sendMessage(hello);
System.out.println("sendok = " + sendok);
} catch (Exception e) {
e.printStackTrace();
}
}}