OfflineStanzaReceiver offlineReceiver = (OfflineStanzaReceiver) storageProviderRegistry.retrieve(OfflineStorageProvider.class);
DeliveringInternalInboundStanzaRelay internalStanzaRelay = new DeliveringInternalInboundStanzaRelay(serverEntity,
resourceRegistry, accountManagement,offlineReceiver);
DeliveringExternalInboundStanzaRelay externalStanzaRelay = new DeliveringExternalInboundStanzaRelay();
StanzaRelayBroker stanzaRelayBroker = new StanzaRelayBroker();
stanzaRelayBroker.setInternalRelay(internalStanzaRelay);
stanzaRelayBroker.setExternalRelay(externalStanzaRelay);
ServerFeatures serverFeatures = new ServerFeatures();
serverFeatures.setAuthenticationMethods(saslMechanisms);
serverRuntimeContext = new DefaultServerRuntimeContext(serverEntity, stanzaRelayBroker, serverFeatures,
dictionaries, resourceRegistry);
serverRuntimeContext.setStorageProviderRegistry(storageProviderRegistry);
serverRuntimeContext.setTlsContextFactory(tlsContextFactory);
serverRuntimeContext.addModule(new ServiceDiscoveryModule());
serverRuntimeContext.addModule(new RosterModule());
stanzaRelayBroker.setServerRuntimeContext(serverRuntimeContext);
internalStanzaRelay.setServerRuntimeContext(serverRuntimeContext);
externalStanzaRelay.setServerRuntimeContext(serverRuntimeContext);
if (endpoints.size() == 0)
throw new IllegalStateException("server must have at least one endpoint");