-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaXmppClient.java
More file actions
56 lines (41 loc) · 1.26 KB
/
JavaXmppClient.java
File metadata and controls
56 lines (41 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
public class JavaXmppClient implements Runnable {
public static String host = "host";
public static int port = 5222;
public static String service = "hostname";
public static String user = null;
public static String pwd = null;
public void run() {
try {
XmppManager xmppManager = XmppManager.getInstance();
xmppManager.setHost(host);
xmppManager.setPort(port);
xmppManager.setService(host);
xmppManager.setUsername(user);
xmppManager.setPassword(pwd);
System.out.println("XmppManager going to start.");
xmppManager.init();
Thread.currentThread().sleep(1000);
} catch (Exception e) {
e.printStackTrace();
System.out
.println("Connection Initalization with xmpp server failed with exception msg -"
+ e.getMessage());
}
}
public static void main(String a[]) {
host = a[0];
service = a[0]; // host and service are same
user = a[1];
pwd = a[2];
if (null == a[0] || null == a[1] || null == pwd) {
System.out
.println("USAGE: java JavaXmppClient <host> <user> <pwd>");
System.exit(-1);
}
System.out.println("---THIS BEHAVE AS A LISTINING USER (" + user
+ ")---");
JavaXmppClient xmppMobileClient = new JavaXmppClient();
Thread thread = new Thread(xmppMobileClient);
thread.start();
}
}