public StanzaHandler getHandler(Stanza stanza) {
if (stanza == null) return null;
String name = stanza.getName();
if ("xml".equals(name)) return new XMLPrologHandler();
else if ("stream".equals(name)) return new StreamStartHandler();
else if (iqHandler.verify(stanza)) return getIQHandler(stanza);
else if (messageHandler.verify(stanza)) return getMessageHandler(stanza);
else if (presenceHandler.verify(stanza)) return getPresenceHandler(stanza);
else {
// this is not a core stanza (RFC3920), but something like the following