By default, applets aren’'t allowed to open sockets to servers other than the server the applet is from. So, you have a couple of options:
Make it a signed applet so that users can grant special permissions to it to allow opening sockets to any host.
Have the applet be served from the same server that the XMPP server is running on.
Write a servlet or some other middle tier that can act as a proxy on the server-side for opening connections to other hosts. Your applet could then talk to that servlet.