Hi,
I am trying to create a simple program which would connect to google talk and get the buddy list from that server.
I am trying to run this program from my company’'s network.
***CODE ***********************************************************
public class GTalkTest {
public static void main(String[] args) {
try {
System.out.println(“About to open the connection”);
ConnectionConfiguration config =
new ConnectionConfiguration(“talk.google.com”,5223);
XMPPConnection connection =
new XMPPConnection(config);
System.out.println("Connection opened - "+connection);
connection.login("shashishrimali@gmail.com", "XXXXX");
System.out.println("logged in ");
Roster roster = connection.getRoster();
if (roster==null)
{
System.out.println(“NULL”);
}
Iterator iter = roster.getEntries().iterator();
if (iter==null)
{
System.out.println(“NULL”);
}
while (iter.hasNext()) {
RosterEntry entry = (RosterEntry) iter.next();
System.out.println(entry.getName() + " (" + entry.getUser() + “)”);
}
} catch(Exception e)
{
System.out.println(e.toString());
}
}
}
OUTPUT::
About to open the connection
Connection opened - org.jivesoftware.smack.XMPPConnection@1e4457d
java.lang.IllegalStateException: Not connected to server.