}
private static void sendMessagesUsingClients(Entity localUser, Entity remoteServer, Entity remoteUser,
String remotePassword, String keystorePath, String keystorePassword) throws XMPPException,
InterruptedException {
ConnectionConfiguration localConnectionConfiguration = new ConnectionConfiguration("localhost", 5222);
localConnectionConfiguration.setKeystorePath(keystorePath);
localConnectionConfiguration.setTruststorePath(keystorePath);
localConnectionConfiguration.setTruststorePassword(keystorePassword);
XMPPConnection localClient = new XMPPConnection(localConnectionConfiguration);
localClient.connect();
localClient.login(localUser.getNode(), "password1");
localClient.addPacketListener(new PacketListener() {
public void processPacket(Packet packet) {
System.out.println("# " + packet);
}
}, new PacketFilter() {
public boolean accept(Packet arg0) {
return true;
}
});
ConnectionConfiguration remoteConnectionConfiguration = new ConnectionConfiguration(remoteServer.getFullQualifiedName(), 5222);
remoteConnectionConfiguration.setKeystorePath(keystorePath);
remoteConnectionConfiguration.setTruststorePath(keystorePath);
remoteConnectionConfiguration.setTruststorePassword(keystorePassword);
XMPPConnection remoteClient = new XMPPConnection(remoteConnectionConfiguration);
remoteClient.connect();
remoteClient.login(remoteUser.getNode(), remotePassword);