return client;
}
private XMPPServer createLocalServer(Entity localServer, Entity localUser, String password, String keystorePath,
String keystorePassword) throws AccountCreationException, FileNotFoundException, Exception {
XMPPServer server = new XMPPServer(localServer.getDomain());
StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();
final AccountManagement accountManagement = (AccountManagement) providerRegistry
.retrieve(AccountManagement.class);
if (!accountManagement.verifyAccountExists(localUser)) {
accountManagement.addUser(localUser, password);
}
// S2S endpoint
TCPEndpoint s2sEndpoint = new TCPEndpoint();
s2sEndpoint.setPort(5269);
server.addEndpoint(s2sEndpoint);
// C2S endpoint
server.addEndpoint(new TCPEndpoint());
server.setStorageProviderRegistry(providerRegistry);
server.setTLSCertificateInfo(new File(keystorePath), keystorePassword);
server.start();
return server;
}