private static Packet parse(final String input) throws DocumentException, XmlPullParserException, IOException
    {
        final XMPPPacketReader reader = new XMPPPacketReader();
        final Element element = reader.read(new StringReader(input)).getRootElement();
        return switch (element.getName()) {
            case "presence" -> new Presence(element, true);
            case "iq"       -> new IQ(element, true);
            case "message"  -> new Message(element, true);
            default -> throw new IllegalStateException("Unexpected element name: " + element.asXML());
        };
    }
Tries to parse a stanza from an input text. This method throws an exception when the input cannot be parsed.

@param input The text to be parsed
@return the stanza that resulted from parsing
xmppserver/src/test/java/org/jivesoftware/openfire/csi/CsiManagerTest.java