Cache the parser availability of the roundtrip feature

As otherwise there would be multiple log statements (which are of level
fine but nevertheless).

PacketParserUtils: XmlPullParser does not support XML_ROUNDTRIP org.xmlpull.v1.XmlPullParserException: unsupported feature: http://xmlpull.org/v1/doc/features.html#xml-roundtrip (position:START_DOCUMENT null@1:1)
PacketParserUtils: 	at org.kxml2.io.KXmlParser.setFeature(KXmlParser.java:2091)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:150)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:172)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.openStream(XMPPTCPConnection.java:963)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter.access$2600(XMPPTCPConnection.java:1224)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketWriter$1.run(XMPPTCPConnection.java:1263)
PacketParserUtils: XmlPullParser does not support XML_ROUNDTRIP org.xmlpull.v1.XmlPullParserException: unsupported feature: http://xmlpull.org/v1/doc/features.html#xml-roundtrip (position:START_DOCUMENT null@1:1)
PacketParserUtils: 	at org.kxml2.io.KXmlParser.setFeature(KXmlParser.java:2091)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:150)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:172)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.openStream(XMPPTCPConnection.java:963)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:970)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:989)
PacketParserUtils: XmlPullParser does not support XML_ROUNDTRIP org.xmlpull.v1.XmlPullParserException: unsupported feature: http://xmlpull.org/v1/doc/features.html#xml-roundtrip (position:START_DOCUMENT null@1:1)
PacketParserUtils: 	at org.kxml2.io.KXmlParser.setFeature(KXmlParser.java:2091)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:150)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:172)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.openStream(XMPPTCPConnection.java:963)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:970)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:989)
PacketParserUtils: XmlPullParser does not support XML_ROUNDTRIP org.xmlpull.v1.XmlPullParserException: unsupported feature: http://xmlpull.org/v1/doc/features.html#xml-roundtrip (position:START_DOCUMENT null@1:1)
PacketParserUtils: 	at org.kxml2.io.KXmlParser.setFeature(KXmlParser.java:2091)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:150)
PacketParserUtils: 	at org.jivesoftware.smack.util.PacketParserUtils.newXmppParser(PacketParserUtils.java:172)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.openStream(XMPPTCPConnection.java:963)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:970)
PacketParserUtils: 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:989)
Fix initialization order issue with DEBUG_ENABLED

If a user enabled Smack debug via the property 'smack.debugEnabled', a
ConnectionConfiguration could be created where debuggerEnabled is
'false', because Smack is not yet initialized.

Also make sure that if the property is not set, it won't overwrite
DEBUG_ENABLED = true.

Thanks to William Murphy for providing a detailed issue description and
supposing a fix.
Fix NPE in MUCItem if role is null
Fix NPE in MultiUserChatManager.getMultiUserchat()

Since the HashMap has WeakReferences as values, there are two levels at
which values could be null.
Setup Roster before sending initial presence

Thanks to Phil Winder for reporting the issue.
Make ProviderManager handle StreamFeatureProvider(s)

when a new ProviderLoader is added. This was previously missing.
Fix MUC invitationPacketListener ClassCastException

Make sure that the Packets are of type Message. To prevent:

E/AbstractXMPPConnection﹕ Exception in packet listener
    java.lang.ClassCastException: org.jivesoftware.smack.packet.Presence cannot be cast to org.jivesoftware.smack.packet.Message
            at org.jivesoftware.smackx.muc.MultiUserChatManager$2.processPacket(MultiUserChatM anager.java:124)
            at org.jivesoftware.smack.AbstractXMPPConnection.notifiyReceivedListeners(Abstract XMPPConnection.java:854)
            at org.jivesoftware.smack.AbstractXMPPConnection$ListenerNotification.run(Abstract XMPPConnection.java:876)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:153)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:267)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:856)
Add SCRAM-SHA1 support

Thanks to Stefan Karlsson for helping with the implementation.

Also add SASLMechanism.checkIfSuccessfulOrThrow(), to increase the
security by verifying the mechanisms state at the end of SASL
authentication.

SASLMechanism now has a SASLPrep StringTransformer.

Refactor SHA1 functions out of StringUtils into SHA1 utility class.

Add MAC utility class.

Make DummyConnection getSentpacket() methods use generics to make unit
testing SCRAM-SHA1 easier.

Fixes SMACK-398
Use switch/case instead if/else-if in parsePackets()
Don't check for END_DOCUMENT parsePackets()

instead use the event switch/case and log a warning if this ever
happens, as it's likely a programming error.