} else {
keystorePath = "src/main/config/bogus_mina_tls.cert";
keystorePassword = "boguspw";
}
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, "password1");
}
// S2S endpoint
server.addEndpoint(new S2SEndpoint());
// C2S endpoint
server.addEndpoint(new TCPEndpoint());
server.setStorageProviderRegistry(providerRegistry);
server.setTLSCertificateInfo(new File(keystorePath), keystorePassword);
server.start();
// enable server connection to use ping
//server.addModule(new XmppPingModule());
ServerRuntimeContext serverRuntimeContext = server.getServerRuntimeContext();
Thread.sleep(2000);
XMPPServerConnectorRegistry registry = serverRuntimeContext.getServerConnectorRegistry();
XMPPServerConnector connector = registry.connect(remoteServer);
Stanza stanza = new StanzaBuilder("message", NamespaceURIs.JABBER_SERVER)
.addAttribute("from", localUser.getFullQualifiedName())
.addAttribute("to", remoteUser.getFullQualifiedName())
.startInnerElement("body", NamespaceURIs.JABBER_SERVER)
.addText("Hello world")
.endInnerElement()
.build();
connector.write(stanza);
//sendMessagesUsingClients(localUser, remoteServer, remoteUser, remotePassword, keystorePath, keystorePassword);
Thread.sleep(50000);
server.stop();
}