|
@@ -258,3 +258,41 @@ class MailTests(unittest.TestCase):
|
258
|
258
|
m.expunge()
|
259
|
259
|
m.close()
|
260
|
260
|
m.logout()
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+class XMPPTests(unittest.TestCase):
|
|
264
|
+ def test_xmpp_c2s(self):
|
|
265
|
+ """Prosody is listening on 5222 for clients and requiring TLS"""
|
|
266
|
+
|
|
267
|
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
268
|
+ s.connect((TEST_SERVER, 5222))
|
|
269
|
+
|
|
270
|
+ # Based off http://wiki.xmpp.org/web/Programming_Jabber_Clients
|
|
271
|
+ s.send("<stream:stream xmlns:stream='http://etherx.jabber.org/streams' "
|
|
272
|
+ "xmlns='jabber:client' to='sovereign.local' version='1.0'>")
|
|
273
|
+
|
|
274
|
+ data = s.recv(1024)
|
|
275
|
+ s.close()
|
|
276
|
+
|
|
277
|
+ self.assertRegexpMatches(
|
|
278
|
+ data,
|
|
279
|
+ "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'><required/></starttls>"
|
|
280
|
+ )
|
|
281
|
+
|
|
282
|
+ def test_xmpp_s2s(self):
|
|
283
|
+ """Prosody is listening on 5269 for servers"""
|
|
284
|
+
|
|
285
|
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
286
|
+ s.connect((TEST_SERVER, 5269))
|
|
287
|
+
|
|
288
|
+ # Base off http://xmpp.org/extensions/xep-0114.html
|
|
289
|
+ s.send("<stream:stream xmlns:stream='http://etherx.jabber.org/streams' "
|
|
290
|
+ "xmlns='jabber:component:accept' to='sovereign.local'>")
|
|
291
|
+
|
|
292
|
+ data = s.recv(1024)
|
|
293
|
+ s.close()
|
|
294
|
+
|
|
295
|
+ self.assertRegexpMatches(
|
|
296
|
+ data,
|
|
297
|
+ "from='sovereign.local'"
|
|
298
|
+ )
|