TIL that XMPP works by essentially streaming an endless XML document that you're supposed to feed into a streaming parser or something. I thought it used some kind of length-prefixed packet thing like most TCP-based protocols do. And apparently you can negotiate TLS in the middle of the XML stream and continue it over an encrypted connection?!..