+
    üÐj'°  ã                   óª  € R t ^ RIHt ^ RIHt ^ RIHtHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHt ^ R	IHtHtHtHt ^ R
IHt ^ RIHt  ^ RIHt ]tR5t^ RIHt ^ RIH t  Rt" ! R R]PF                  4      t$ ! R R]PF                  4      t% ! R R]PF                  4      t& ! R R]'4      t( ! R R]PF                  4      t) ! R R]PF                  4      t* ! R R]PF                  4      t+ ! R R ]PF                  4      t, ! R! R"]PZ                  4      t. ! R# R$]PF                  4      t/ ! R% R&]PF                  4      t0 ! R' R(4      t1 ! R) R*]Pd                  4      t3 ! R+ R,]Pd                  4      t4 ! R- R.]PF                  4      t5 ! R/ R0]PF                  4      t6 ! R1 R2]PF                  4      t7 ! R3 R4]4      t8R#   ]! d	    RtR6t ELmi ; i)7z8
Tests for L{twisted.words.protocols.jabber.xmlstream}.
)ÚskipIf)ÚverifyObject)ÚdeferÚtask)ÚConnectionLost)ÚIProtocolFactory)Úfailure)Úproto_helpers)Úunittest)ÚerrorÚijabberÚjidÚ	xmlstream)Ú!GenericXmlStreamFactoryTestsMixin)Údomish)Ússl)ÚClientTLSOptions)ÚCertificateOptionsNúurn:ietf:params:xml:ns:xmpp-tlsc                   ó<   a € ] tR t^$t o RtR tR tR tR tRt	V t
R# )ÚHashPasswordTestsz&
Tests for L{xmlstream.hashPassword}.
c                óX   € \         P                  ! RR4      pV P                  RV4       R# )zC
The sid and secret are concatenated to calculate sha1 hex digest.
Ú12345ÚsecretÚ(99567ee91b2c7cabf607f10cb9f4a3634fa820e0N©r   ÚhashPasswordÚassertEqual©ÚselfÚhashs   & ÚI/usr/lib/python3/dist-packages/twisted/words/test/test_jabberxmlstream.pyÚ
test_basicÚHashPasswordTests.test_basic)   s'   € ô ×%Ò% g¨xÓ8ˆØ×ÑÐCÀTÖJó    c                óR   € V P                  \        \        P                  RR4       R# )z2
The session identifier must be a unicode object.
s   Â¹2345r   N©ÚassertRaisesÚ	TypeErrorr   r   ©r   s   &r!   Útest_sidNotUnicodeÚ$HashPasswordTests.test_sidNotUnicode0   s   € ð 	×Ñœ)¤Y×%;Ñ%;¸_ÈhÖWr$   c                óR   € V P                  \        \        P                  RR4       R# )z(
The password must be a unicode object.
r   s   secrÃ©tNr&   r)   s   &r!   Útest_passwordNotUnicodeÚ)HashPasswordTests.test_passwordNotUnicode6   s   € ð 	×Ñœ)¤Y×%;Ñ%;¸WÐFVÖWr$   c                óX   € \         P                  ! RR4      pV P                  RV4       R# )zL
The concatenated sid and password must be encoded to UTF-8 before hashing.
r   u   secrÃ©tÚ(659bf88d8f8e179081f7f3b4a8e7d224652d2853Nr   r   s   & r!   Útest_unicodeSecretÚ$HashPasswordTests.test_unicodeSecret<   s'   € ô ×%Ò% g¨}Ó=ˆØ×ÑÐCÀTÖJr$   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r"   r*   r-   r1   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r!   r   r   $   s(   ø‡ € ñòKòXòX÷Kð Kr$   r   c                   ól   a € ] tR t^Dt o RtR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tRtV tR# )ÚIQTestsz?
Tests both IQ and the associated IIQResponseTracker callback.
c                óÒ  € \         P                  ! R 4      pRVn        \         P                  ! V4      V n         \        P
                  ! 4       V n        V P                  P                  V P                   n        V P                   P                  \        P                  ! 4       4       V P                   P                  R4       \         P                  ! V P                   R4      V n        R# )Ú	otherhostÚtestnszm<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='testns' from='otherhost' version='1.0'>ÚgetN)r   ÚConnectAuthenticatorÚ	namespaceÚ	XmlStreamr   ÚClockÚclockÚ	callLaterÚ
_callLaterÚmakeConnectionr	   ÚStringTransportÚdataReceivedÚIQÚiq)r   Úauthenticators   & r!   ÚsetUpÚIQTests.setUpI   s™   € Ü!×6Ò6°{ÓCˆØ"*ˆÔÜ"×,Ò,¨]Ó;ˆŒÜ—Z’Z“\ˆŒ
Ø$(§J¡J×$8Ñ$8ˆ�‰Ô!Ø�‰×%Ñ%¤m×&CÒ&CÓ&EÔFØ�‰×#Ñ#ð=ô	
ô —,’,˜tŸ~™~¨uÓ5ˆŽr$   c                ó�   € V P                  V P                  R ,          R4       V P                  V P                  R,          4       R# )ÚtyperB   ÚidN)r   rN   Ú
assertTruer)   s   &r!   Ú	testBasicÚIQTests.testBasicV   s.   € Ø×Ñ˜Ÿ™ �¨%Ô0Ø�‰˜Ÿ™ �Ö&r$   c                ój  € V P                   P                  P                  4        V P                  P	                  4        V P                  R ,          P                  R4      pV P                  V P                   P                  P                  4       RV,           R,           RV,           R,           .4       R# )rT   zutf-8s   <iq type='get' id='s   '/>s   <iq id='s   ' type='get'/>N)r   Ú	transportÚclearrN   ÚsendÚencodeÚassertInÚvalue)r   ÚidBytess   & r!   ÚtestSendÚIQTests.testSendZ   s   € Ø�‰× Ñ ×&Ñ&Ô(Ø�‰�‰ŒØ—'‘'˜$•-×&Ñ& wÓ/ˆØ�‰Ø�N‰N×$Ñ$×*Ñ*Ó,à&¨Õ0°6Õ9Ø˜gÕ%Ð(9Õ9ðö	
r$   c                óÔ   a € V 3R  lpS P                   P                  4       pVP                  V4       S P                  pVP	                  RS P                   R,          ,          4       V# )c                 ó:   <€ SP                  V R ,          R4       R# )rS   ÚresultN)r   )rd   r   s   &€r!   ÚcbÚ&IQTests.testResultResponse.<locals>.cbg   s   ø€ Ø×Ñ˜V F�^¨XÖ6r$   ú<iq type='result' id='%s'/>rT   )rN   r[   ÚaddCallbackr   rL   )r   re   ÚdÚxss   f   r!   ÚtestResultResponseÚIQTests.testResultResponsef   sM   ø€ õ	7ð �G‰G�L‰L‹NˆØ	�‰�bÔà�^‰^ˆØ
�‰Ð5¸¿¹À½ÕEÔFØˆr$   c                óä   € V P                   P                  4       pV P                  V\        P                  4       V P
                  pVP                  R V P                   R,          ,          4       V# )z<iq type='error' id='%s'/>rT   )rN   r[   ÚassertFailurer   ÚStanzaErrorr   rL   ©r   ri   rj   s   &  r!   ÚtestErrorResponseÚIQTests.testErrorResponseq   sO   € Ø�G‰G�L‰L‹NˆØ×Ñ˜1œe×/Ñ/Ô0à�^‰^ˆØ
�‰Ð4°t·w±w¸tµ}ÕDÔEØˆr$   c                óÖ   a € S P                   p\         P                  ! V4       S P                  VP                  4       V 3R lpVP	                  RVR4       VP                  R4       R# )z§
Test that untracked iq responses don't trigger any action.

Untracked means that the id of the incoming response iq is not
in the stream's C{iqDeferreds} dictionary.
c                 ó@   <€ SP                  \        V R R4      4       R# )ÚhandledFN)ÚassertFalseÚgetattr)rN   r   s   &€r!   re   Ú*IQTests.testNonTrackedResponse.<locals>.cb‰   s   ø€ Ø×ÑœW R¨°EÓ:Ö;r$   z/iqz<iq type='result' id='test'/>Néÿÿÿÿ)r   ÚupgradeWithIQResponseTrackerrv   ÚiqDeferredsÚaddObserverrL   )r   rj   re   s   f  r!   ÚtestNonTrackedResponseÚIQTests.testNonTrackedResponsey   sV   ø€ ð �^‰^ˆÜ×.Ò.¨rÔ2ð 	×Ñ˜Ÿ™Ô(õ
	<ð 	�‰�u˜b "Ô%ð 	�‰Ð7Ö8r$   c                óþ   € V P                   P                  4       pV P                  pVP                  RV P                   R,          ,          4       V P	                  V P                   R,          VP
                  4       V# )z†
Test if the deferred associated with an iq request is removed
from the list kept in the L{XmlStream} object after it has
been fired.
rg   rT   )rN   r[   r   rL   ÚassertNotInr{   rp   s   &  r!   ÚtestCleanupÚIQTests.testCleanup‘   sW   € ð �G‰G�L‰L‹NˆØ�^‰^ˆØ
�‰Ð5¸¿¹À½ÕEÔFØ×Ñ˜Ÿ™ �¨¯©Ô7Øˆr$   c                ó    € V P                   P                  4       pV P                  pVP                  R4       V P	                  V\
        4       V# )zq
Test if deferreds for iq's that haven't yet received a response
have their errback called on stream disconnect.
úClosed by peer)rN   r[   r   ÚconnectionLostrn   r   rp   s   &  r!   ÚtestDisconnectCleanupÚIQTests.testDisconnectCleanupž   s@   € ð �G‰G�L‰L‹NˆØ�^‰^ˆØ
×ÑÐ*Ô+Ø×Ñ˜1œnÔ-Øˆr$   c                ó¤   a a€ VV 3R loS P                   P                  4       pVP                  S4       S P                  P	                  R4       V# )zf
Test to make sure the errbacks cannot cause the iteration of the
iqDeferreds to blow up in our face.
c                 ó†   <€ \         P                  ! SP                   4      P                  4       pVP                  S4       R # ©N)r   rM   r[   Ú
addErrback)r   ri   Úebr   s   & €€r!   rŒ   Ú'IQTests.testNoModifyingDict.<locals>.eb°   s*   ø€ Ü—’˜TŸ^™^Ó,×1Ñ1Ó3ˆAØ�L‰L˜Ör$   r„   )rN   r[   r‹   r   r…   )r   ri   rŒ   s   f @r!   ÚtestNoModifyingDictÚIQTests.testNoModifyingDictª   s=   ù€ ö	ð �G‰G�L‰L‹NˆØ	�‰�RÔØ�‰×%Ñ%Ð&6Ô7Øˆr$   c                ój  € ^<V P                   n        V P                   P                  4       pV P                  V\        P
                  4       V P                  P                  ^^<.4       V P                  V P                  P                  4       V P                  V P                  P                  4       V# )z;
Test that an iq request with a defined timeout times out.
)rN   Útimeoutr[   rn   r   ÚTimeoutErrorrG   Úpumprv   Úcallsr{   ©r   ri   s   & r!   ÚtestRequestTimingOutÚIQTests.testRequestTimingOut¹   s}   € ð ˆ�‰ŒØ�G‰G�L‰L‹NˆØ×Ñ˜1œi×4Ñ4Ô5à�
‰
�‰˜˜B˜Ô Ø×Ñ˜Ÿ™×)Ñ)Ô*Ø×Ñ˜Ÿ™×3Ñ3Ô4Øˆr$   c                ór  € ^<V P                   n        V P                   P                  4       pV P                  P	                  ^V P
                  P                  RV P                   R,          ,          4       V P                  P                  ^^.4       V P                  V P                  P                  4       V# )z‚
Test that an iq request with a defined timeout does not time out
when a response was received before the timeout period elapsed.
rg   rT   )
rN   r‘   r[   rG   rH   r   rL   r“   rv   r”   r•   s   & r!   ÚtestRequestNotTimingOutÚIQTests.testRequestNotTimingOutÆ   sƒ   € ð
 ˆ�‰ŒØ�G‰G�L‰L‹NˆØ�
‰
×ÑØØ�N‰N×'Ñ'Ø)¨D¯G©G°D­MÕ9ô	
ð
 	�
‰
�‰˜˜A˜ÔØ×Ñ˜Ÿ™×)Ñ)Ô*Øˆr$   c                ó  € ^<V P                   n        V P                   P                  4       pV P                  pVP	                  R4       V P                  V\        4       V P                  V P                  P                  4       V# )zd
Test if timeouts for iq's that haven't yet received a response
are cancelled on stream disconnect.
r„   )
rN   r‘   r[   r   r…   rn   r   rv   rG   r”   rp   s   &  r!   Ú!testDisconnectTimeoutCancellationÚ)IQTests.testDisconnectTimeoutCancellationÖ   sc   € ð ˆ�‰ŒØ�G‰G�L‰L‹Nˆà�^‰^ˆØ
×ÑÐ*Ô+Ø×Ñ˜1œnÔ-Ø×Ñ˜Ÿ™×)Ñ)Ô*Øˆr$   )rG   rN   r   N)r4   r5   r6   r7   r8   rP   rV   r`   rk   rq   r}   r�   r†   rŽ   r–   r™   rœ   r9   r:   r;   s   @r!   r>   r>   D   sK   ø‡ € ñò6ò'ò

ò	òò9ò0ò
òòò÷ ð r$   r>   c                   ó€   a € ] tR t^æt o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tRtV tR# )ÚXmlStreamTestsc                ó   € R V n         R# ©TN)ÚgotStreamStart©r   Úobjs   &&r!   ÚonStreamStartÚXmlStreamTests.onStreamStartç   ó
   € Ø"ˆÖr$   c                ó   € R V n         R# r¡   )ÚgotStreamEndr£   s   &&r!   ÚonStreamEndÚXmlStreamTests.onStreamEndê   s
   € Ø ˆÖr$   c                ó   € R V n         R# r¡   )ÚgotStreamErrorr£   s   &&r!   ÚonStreamErrorÚXmlStreamTests.onStreamErrorí   r§   r$   c                óº  € RV n         RV n        RV n        \        P                  ! \        P
                  ! 4       4      pVP                  RV P                  4       VP                  RV P                  4       VP                  RV P                  4       VP                  \        P                  ! 4       4       WP                  n        RVn        RVn        Wn        R# )z)
Set up XmlStream and several observers.
Fz//event/stream/startú//event/stream/endz//event/stream/errorrA   N©é   é    )r¢   r©   r­   r   rE   ÚAuthenticatorr|   r¥   rª   r®   rJ   r	   Ú StringTransportWithDisconnectionrY   ÚprotocolrD   Úversion©r   rj   s   & r!   rP   ÚXmlStreamTests.setUpð   s¨   € ð $ˆÔØ!ˆÔØ#ˆÔÜ× Ò ¤×!8Ò!8Ó!:Ó;ˆØ
�‰Ð-¨t×/AÑ/AÔBØ
�‰Ð+¨T×-=Ñ-=Ô>Ø
�‰Ð-¨t×/AÑ/AÔBØ
×Ñœ-×HÒHÓJÔKØ "�‰ÔØˆŒØˆŒ
ØŽr$   c                óp  € V P                   pVP                  4        V P                   P                  P                  4       ^ R P	                  R4      pV P                  RV4       V P                  RV4       V P                  RV4       V P                  RV4       V P                  VP                  4       R# )z.
Basic test on the header sent by sendHeader.
ó    ó   <stream:streamó/   xmlns:stream='http://etherx.jabber.org/streams'ó   xmlns='testns'ó   version='1.0'Nry   )r   Ú
sendHeaderrY   r^   Úsplitr]   rU   Ú_headerSent©r   rj   ÚsplitHeaders   &  r!   Útest_sendHeaderBasicÚ#XmlStreamTests.test_sendHeaderBasic  sŒ   € ð �^‰^ˆØ
�‰ŒØ—n‘n×.Ñ.×4Ñ4Ó6°q¸Ð<×BÑBÀ4ÓHˆØ�‰Ð'¨Ô5Ø�‰ÐHÈ+ÔVØ�‰Ð'¨Ô5Ø�‰Ð&¨Ô4Ø�‰˜Ÿ™Ö'r$   c                ó²  € V P                   pRVP                  R&   VP                  4        V P                   P                  P	                  4       ^ R
 P                  R4      pV P                  RV4       V P                  RV4       V P                  RV4       V P                  RV4       V P                  RV4       V P                  VP                  4       R	# )z-
Test for additional namespace declarations.
Údbzjabber:server:dialbackr¼   r½   r¾   s!   xmlns:db='jabber:server:dialback'r¿   rÀ   Nry   )	r   ÚprefixesrÁ   rY   r^   rÂ   r]   rU   rÃ   rÄ   s   &  r!   Ú#test_sendHeaderAdditionalNamespacesÚ2XmlStreamTests.test_sendHeaderAdditionalNamespaces  sª   € ð �^‰^ˆØ04ˆ�‰Ð,Ñ-Ø
�‰ŒØ—n‘n×.Ñ.×4Ñ4Ó6°q¸Ð<×BÑBÀ4ÓHˆØ�‰Ð'¨Ô5Ø�‰ÐHÈ+ÔVØ�‰Ð:¸KÔHØ�‰Ð'¨Ô5Ø�‰Ð&¨Ô4Ø�‰˜Ÿ™Ö'r$   c                óX  € V P                   p\        P                  ! R4      Vn        \        P                  ! R4      Vn        RVn        VP                  4        VP                  P                  4       ^ R P                  R4      pV P                  RV4       V P                  RV4       R# )	z+
Test addressing when initiating a stream.
ÚthisHostÚ	otherHostTr¼   ó   to='otherhost'ó   from='thishost'Nry   )r   r   ÚJIDÚ
thisEntityÚotherEntityÚ
initiatingrÁ   rY   r^   rÂ   r]   rÄ   s   &  r!   Útest_sendHeaderInitiatingÚ(XmlStreamTests.test_sendHeaderInitiating  s   € ð �^‰^ˆÜŸš 
Ó+ˆŒÜŸš Ó-ˆŒØˆŒØ
�‰ŒØ—l‘l×(Ñ(Ó*¨1¨RÐ0×6Ñ6°tÓ<ˆØ�‰Ð'¨Ô5Ø�‰Ð(¨+Ö6r$   c                óŠ  € V P                   p\        P                  ! R4      Vn        \        P                  ! R4      Vn        RVn        RVn        VP                  4        VP                  P                  4       ^ R
 P                  R4      pV P                  RV4       V P                  RV4       V P                  RV4       R	# )z*
Test addressing when receiving a stream.
rÎ   rÏ   FÚ	session01r¼   rÐ   rÑ   s   id='session01'Nry   )r   r   rÒ   rÓ   rÔ   rÕ   ÚsidrÁ   rY   r^   rÂ   r]   rÄ   s   &  r!   Útest_sendHeaderReceivingÚ'XmlStreamTests.test_sendHeaderReceiving*  s•   € ð �^‰^ˆÜŸš 
Ó+ˆŒÜŸš Ó-ˆŒØˆŒØˆŒØ
�‰ŒØ—l‘l×(Ñ(Ó*¨1¨RÐ0×6Ñ6°tÓ<ˆØ�‰Ð'¨Ô5Ø�‰Ð(¨+Ô6Ø�‰Ð'¨Ö5r$   c                óÎ   € V P                   pVP                  R4       VP                  R4       V P                  V P                  4       V P                  V P                  4       R# )z.
Test events when a stream error is received.
ú�<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='example.com' id='12345' version='1.0'>z<stream:error/>N)r   rL   rU   r­   r©   r¹   s   & r!   Útest_receiveStreamErrorÚ&XmlStreamTests.test_receiveStreamError9  sQ   € ð �^‰^ˆØ
�‰ð;ô	
ð
 	�‰Ð)Ô*Ø�‰˜×+Ñ+Ô,Ø�‰˜×)Ñ)Ö*r$   c                óT  € V P                   pRVn        VP                  4        VP                  P	                  4        VP                  \        P                  ! R4      4       V P                  RVP                  P                  4       4       V P                  V P                  4       R# )z{
Test sendStreamError on an initiating xmlstream with a header sent.

An error should be sent out and the connection lost.
Túversion-unsupportedr$   N©r   rÕ   rÁ   rY   rZ   ÚsendStreamErrorr   ÚStreamErrorÚassertNotEqualr^   rU   r©   r¹   s   & r!   Útest_sendStreamErrorInitiatingÚ-XmlStreamTests.test_sendStreamErrorInitiatingG  sv   € ð �^‰^ˆØˆŒØ
�‰ŒØ
�‰×ÑÔØ
×Ñœ5×,Ò,Ð-BÓCÔDØ×Ñ˜C §¡×!3Ñ!3Ó!5Ô6Ø�‰˜×)Ñ)Ö*r$   c                ój  € V P                   pRVn        VP                  P                  4        VP	                  \
        P                  ! R4      4       V P                  VP                  4       V P                  RVP                  P                  4       4       V P                  V P                  4       R# )zÐ
Test sendStreamError on an initiating xmlstream without having sent a
header.

In this case, no header should be generated. Also, the error should
not be sent out on the stream. Just closing the connection.
Trâ   r$   N)r   rÕ   rY   rZ   rä   r   rå   Ú	assertNotrÃ   r   r^   rU   r©   r¹   s   & r!   Ú&test_sendStreamErrorInitiatingNoHeaderÚ5XmlStreamTests.test_sendStreamErrorInitiatingNoHeaderU  s}   € ð �^‰^ˆØˆŒØ
�‰×ÑÔØ
×Ñœ5×,Ò,Ð-BÓCÔDØ�‰�r—~‘~Ô&Ø×Ñ˜˜bŸl™l×0Ñ0Ó2Ô3Ø�‰˜×)Ñ)Ö*r$   c                óT  € V P                   pRVn        VP                  4        VP                  P	                  4        VP                  \        P                  ! R4      4       V P                  RVP                  P                  4       4       V P                  V P                  4       R# )zy
Test sendStreamError on a receiving xmlstream with a header sent.

An error should be sent out and the connection lost.
Frâ   r$   Nrã   r¹   s   & r!   Útest_sendStreamErrorReceivingÚ,XmlStreamTests.test_sendStreamErrorReceivinge  sv   € ð �^‰^ˆØˆŒØ
�‰ŒØ
�‰×ÑÔØ
×Ñœ5×,Ò,Ð-BÓCÔDØ×Ñ˜C §¡×!3Ñ!3Ó!5Ô6Ø�‰˜×)Ñ)Ö*r$   c                ój  € V P                   pRVn        VP                  P                  4        VP	                  \
        P                  ! R4      4       V P                  VP                  4       V P                  RVP                  P                  4       4       V P                  V P                  4       R# )zÏ
Test sendStreamError on a receiving xmlstream without having sent a
header.

In this case, a header should be generated. Then, the error should
be sent out on the stream followed by closing the connection.
Frâ   r$   N)r   rÕ   rY   rZ   rä   r   rå   rU   rÃ   ræ   r^   r©   r¹   s   & r!   Ú%test_sendStreamErrorReceivingNoHeaderÚ4XmlStreamTests.test_sendStreamErrorReceivingNoHeaders  s}   € ð �^‰^ˆØˆŒØ
�‰×ÑÔØ
×Ñœ5×,Ò,Ð-BÓCÔDØ�‰˜Ÿ™Ô'Ø×Ñ˜C §¡×!3Ñ!3Ó!5Ô6Ø�‰˜×)Ñ)Ö*r$   c                óâ   € V P                   pVP                  4        VP                  pVP                  4        V P	                  W!P                  4       V P                  VP                  4       R# )z5
Test resetting the XML stream to start a new layer.
N)r   rÁ   ÚstreamÚresetræ   rê   rÃ   )r   rj   rô   s   &  r!   Ú
test_resetÚXmlStreamTests.test_resetƒ  sJ   € ð �^‰^ˆØ
�‰ŒØ—‘ˆØ
�‰Œ
Ø×Ñ˜F§I¡IÔ.Ø�‰�r—~‘~Ö&r$   c                ó@  € V P                   pVP                  R4       V P                  VP                  P	                  4       R4       VP                  P                  4        \        P                  ! R4      pVP                  V4       V P                  VP                  P	                  4       R4       VP                  P                  4        \        P                  ! R4      pVP                  V4       V P                  VP                  P	                  4       R4       R# )z*
Test send with various types of objects.
ú<presence/>ó   <presence/>s   <stream:features/>N)rA   Úpresence)z http://etherx.jabber.org/streamsÚfeatures)r   r[   r   rY   r^   rZ   r   ÚElement)r   rj   Úels   &  r!   Ú	test_sendÚXmlStreamTests.test_sendŽ  sÅ   € ð �^‰^ˆØ
�‰�ÔØ×Ñ˜Ÿ™×+Ñ+Ó-¨~Ô>à
�‰×ÑÔÜ�^Š^Ð2Ó3ˆØ
�‰�ŒØ×Ñ˜Ÿ™×+Ñ+Ó-¨~Ô>à
�‰×ÑÔÜ�^Š^ÐLÓMˆØ
�‰�ŒØ×Ñ˜Ÿ™×+Ñ+Ó-Ð/DÖEr$   c                óz  aaa€ . o. o. o ! VVV3R lR4      pV! 4       p\         P                  ! V4      pV P                  V.S4       VP                  4        V P                  R.S4       VP	                  R4       V P                  ^\        S4      4       VP                  4        V P                  R.S4       R# )z=
Test that the associated authenticator is correctly called.
c                   óF   <a € ] tR tRt o V3R ltV3R ltV3R ltRtV tR# )Ú<XmlStreamTests.test_authenticator.<locals>.TestAuthenticatori¨  c                ó*   <€ SP                  R 4       R # rŠ   ©Úappend)r   ÚconnectionMadeCallss   &€r!   ÚconnectionMadeÚKXmlStreamTests.test_authenticator.<locals>.TestAuthenticator.connectionMade©  s   ø€ Ø#×*Ñ*¨4Ö0r$   c                ó*   <€ SP                  V4       R # rŠ   r  )r   ÚrootElementÚstreamStartedCallss   &&€r!   ÚstreamStartedÚJXmlStreamTests.test_authenticator.<locals>.TestAuthenticator.streamStarted¬  s   ø€ Ø"×)Ñ)¨+Ö6r$   c                ó*   <€ SP                  V4       R # rŠ   r  )r   rj   ÚassociateWithStreamCallss   &&€r!   ÚassociateWithStreamÚPXmlStreamTests.test_authenticator.<locals>.TestAuthenticator.associateWithStream¯  s   ø€ Ø(×/Ñ/°Ö3r$   r3   N)	r4   r5   r6   r7   r  r  r  r9   r:   )r<   r  r  r  s   @€€€r!   ÚTestAuthenticatorr  ¨  s   ù‡ € õ1õ7÷4ó 4r$   r  Nús<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='example.com' id='12345'>)r   rE   r   r  rL   Úlenrõ   )r   r  Úarj   r  r  r  s   &   @@@r!   Útest_authenticatorÚ!XmlStreamTests.test_authenticator   s²   ú€ ð !ÐØÐØ#%Ð ÷	4ö 	4ñ ÓˆÜ× Ò  Ó#ˆØ×Ñ˜"˜Ð7Ô8Ø
×ÑÔØ×Ñ˜$˜Ð!4Ô5Ø
�‰ð-ô	
ð
 	×Ñ˜œCÐ 2Ó3Ô4Ø
�‰Œ
Ø×Ñ˜$˜Ð!4Ö5r$   )r©   r­   r¢   r   N)r4   r5   r6   r7   r¥   rª   r®   rP   rÆ   rË   rÖ   rÛ   rß   rç   rë   rî   rñ   rö   rÿ   r  r9   r:   r;   s   @r!   rŸ   rŸ   æ   s[   ø‡ € ò#ò!ò#òò"(ò(ò7ò6ò+ò+ò+ò +ò+ò 	'òF÷$6ð 6r$   rŸ   c                   ó   € ] tR tRtRtR# )Ú	TestErroriÁ  r3   N)r4   r5   r6   r7   r9   r3   r$   r!   r  r  Á  s   † Ûr$   r  c                   ó>   a € ] tR tRt o R tR tR tR tR tRt	V t
R# )	ÚAuthenticatorTestsiÅ  c                ó„   € \         P                  ! 4       V n        \         P                  ! V P                  4      V n         R # rŠ   )r   rµ   rO   rE   r)   s   &r!   rP   ÚAuthenticatorTests.setUpÆ  s+   € Ü&×4Ò4Ó6ˆÔÜ"×,Ò,¨T×-?Ñ-?Ó@ˆŽr$   c                ó   € V P                   pVP                  \        P                  ! 4       4       VP	                  R4       V P                  RVP                  4       V P                  RVP                  4       V P                  RVP                  4       V P                  RVP                  4       V P                  RVP                  4       R# )úM
Test streamStart to fill the appropriate attributes from the
stream header.
ú’<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='example.org' to='example.com' id='12345' version='1.0'>NÚinvalidr²   )r   rJ   r	   rK   rL   r   r¸   ÚassertIdenticalrÚ   rD   rÔ   rÓ   r¹   s   & r!   Útest_streamStartÚ#AuthenticatorTests.test_streamStartÊ  s›   € ð
 �^‰^ˆØ
×Ñœ-×7Ò7Ó9Ô:Ø
�‰ðô	
ð 	×Ñ˜ §¡Ô,Ø×Ñ˜T 2§6¡6Ô*Ø×Ñ˜ B§L¡LÔ1Ø×Ñ˜T 2§>¡>Ô2Ø×Ñ˜˜rŸ}™}Ö-r$   c                óÀ   € V P                   pVP                  \        P                  ! 4       4       VP	                  R4       V P                  RVP                  4       R# )zg
Test streamStart to fill the appropriate attributes from the
stream header for a pre-XMPP-1.0 header.
r  N©r´   r´   ©r   rJ   r	   rK   rL   r   r¸   r¹   s   & r!   Útest_streamStartLegacyÚ)AuthenticatorTests.test_streamStartLegacyÝ  sK   € ð
 �^‰^ˆØ
×Ñœ-×7Ò7Ó9Ô:Ø
�‰ð-ô	
ð
 	×Ñ˜ §¡Ö,r$   c                óÀ   € V P                   pVP                  \        P                  ! 4       4       VP	                  R4       V P                  RVP                  4       R# )zo
Test streamStart to fill the appropriate attributes from the
stream header for a version with only one digit.
z<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='example.com' id='12345' version='1'>Nr'  r(  r¹   s   & r!   Útest_streamBadVersionOneDigitÚ0AuthenticatorTests.test_streamBadVersionOneDigitë  sK   € ð
 �^‰^ˆØ
×Ñœ-×7Ò7Ó9Ô:Ø
�‰ð9ô	
ð
 	×Ñ˜ §¡Ö,r$   c                óÀ   € V P                   pVP                  \        P                  ! 4       4       VP	                  R4       V P                  RVP                  4       R# )ze
Test streamStart to fill the appropriate attributes from the
stream header for a malformed version.
z‚<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='example.com' id='12345' version='blah'>Nr'  r(  r¹   s   & r!   Útest_streamBadVersionNoNumberÚ0AuthenticatorTests.test_streamBadVersionNoNumberù  sK   € ð
 �^‰^ˆØ
×Ñœ-×7Ò7Ó9Ô:Ø
�‰ð<ô	
ð
 	×Ñ˜ §¡Ö,r$   ©rO   r   N)r4   r5   r6   r7   rP   r$  r)  r,  r/  r9   r:   r;   s   @r!   r  r  Å  s$   ø‡ € òAò.ò&-ò-÷-ð -r$   r  c                   óD   a € ] tR tRt o R tR tR tR tR tR t	Rt
V tR	# )
ÚConnectAuthenticatorTestsi  c                ó:  € R V n         RV n        \        P                  ! R4      V n        \        P
                  ! V P                  4      V n        V P                  P                  RV P                  4       V P                  P                  RV P                  4       R# )FNrÏ   ú//event/stream/authdú//event/xmpp/initfailed)	ÚgotAuthenticatedÚinitFailurer   rC   rO   rE   r|   ÚonAuthenticatedÚonInitFailedr)   s   &r!   rP   ÚConnectAuthenticatorTests.setUp	  ss   € Ø %ˆÔØˆÔÜ&×;Ò;¸KÓHˆÔÜ"×,Ò,¨T×-?Ñ-?Ó@ˆŒØ�‰×"Ñ"Ð#9¸4×;OÑ;OÔPØ�‰×"Ñ"Ð#<¸d×>OÑ>OÖPr$   c                ó   € R V n         R# r¡   )r7  r£   s   &&r!   r9  Ú)ConnectAuthenticatorTests.onAuthenticated  s
   € Ø $ˆÖr$   c                ó   € Wn         R # rŠ   )r8  )r   r   s   &&r!   r:  Ú&ConnectAuthenticatorTests.onInitFailed  s   € Ø"Ör$   c                ó  €  ! R R4      pV! 4       pV.V P                   n        V P                  P                  4        V P	                  . V P                   P                  4       V P                  V P                  4       R# )z7
Test successful completion of an initialization step.
c                   ó&   a € ] tR tRt o R tRtV tR# )Ú9ConnectAuthenticatorTests.testSucces.<locals>.Initializeri  c                ó   € R # rŠ   r3   r)   s   &r!   Ú
initializeÚDConnectAuthenticatorTests.testSucces.<locals>.Initializer.initialize  s   € Ùr$   r3   N©r4   r5   r6   r7   rD  r9   r:   r;   s   @r!   ÚInitializerrB    s   ø‡ € ÷ð r$   rG  N)r   ÚinitializersrO   ÚinitializeStreamr   rU   r7  ©r   rG  Úinits   &  r!   Ú
testSuccesÚ$ConnectAuthenticatorTests.testSucces  sa   € ÷
	ñ 	ñ ‹}ˆØ'+ fˆ�‰Ô#à×Ñ×+Ñ+Ô-Ø×Ñ˜˜TŸ^™^×8Ñ8Ô9Ø�‰˜×-Ñ-Ö.r$   c                ó˜  €  ! R R4      pV! 4       pV.V P                   n        V P                  P                  4        V P	                  V.V P                   P                  4       V P                  V P                  4       V P                  RV P                  4       V P                  V P                  P                  \        4      4       R# )z)
Test failure of an initialization step.
c                   ó&   a € ] tR tRt o R tRtV tR# )Ú:ConnectAuthenticatorTests.testFailure.<locals>.Initializeri,  c                ó   € \         hrŠ   )r  r)   s   &r!   rD  ÚEConnectAuthenticatorTests.testFailure.<locals>.Initializer.initialize-  s   € Ü�r$   r3   NrF  r;   s   @r!   rG  rP  ,  s   ø‡ € ÷ ð  r$   rG  N)r   rH  rO   rI  r   rv   r7  ÚassertNotIdenticalr8  rU   Úcheckr  rJ  s   &  r!   ÚtestFailureÚ%ConnectAuthenticatorTests.testFailure'  s˜   € ÷
	 ñ 	 ñ ‹}ˆØ'+ fˆ�‰Ô#à×Ñ×+Ñ+Ô-Ø×Ñ˜$˜ §¡×!<Ñ!<Ô=Ø×Ñ˜×.Ñ.Ô/Ø×Ñ  d×&6Ñ&6Ô7Ø�‰˜×(Ñ(×.Ñ.¬yÓ9Ö:r$   c                óœ  € RV P                   n        V P                  pVP                  \        P
                  ! 4       4       VP                  R4       V P                  RVP                  4       V P                  RVP                  4       V P                  RVP                  4       V P                  RVP                  P                  4       V P                  RVP                  4       V P                  V P                  4       VP                  R4       V P!                  RVP"                  4       V P%                  V P                  4       R# )	r   rA   z’<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='example.com' to='example.org' id='12345' version='1.0'>r   úexample.comNz9<stream:features><test xmlns='testns'/></stream:features>r²   ©rA   Útest)rO   rD   r   rJ   r	   rK   rL   r   r¸   rÚ   rÔ   Úhostr#  rÓ   rê   r7  r]   rü   rU   r¹   s   & r!   r$  Ú*ConnectAuthenticatorTests.test_streamStart9  s÷   € ð
 (0ˆ×ÑÔ$Ø�^‰^ˆØ
×Ñœ-×7Ò7Ó9Ô:Ø
�‰ðô	
ð 	×Ñ˜ §¡Ô,Ø×Ñ˜ "§&¡&Ô)Ø×Ñ˜ 2§<¡<Ô0Ø×Ñ˜¨¯©×(;Ñ(;Ô<Ø×Ñ˜T 2§=¡=Ô1Ø�‰�t×,Ñ,Ô-Ø
�‰ØMô	
ð 	�‰Ð(¨"¯+©+Ô6Ø�‰˜×-Ñ-Ö.r$   )rO   r7  r8  r   N)r4   r5   r6   r7   rP   r9  r:  rL  rU  r$  r9   r:   r;   s   @r!   r3  r3    s)   ø‡ € òQò%ò#ò/ò ;÷$/ð /r$   r3  c                   ó6   a € ] tR tRt o RtR tR tR tRtV t	R# )ÚListenAuthenticatorTestsiT  z,
Tests for L{xmlstream.ListenAuthenticator}
c                ó„   € \         P                  ! 4       V n        \         P                  ! V P                  4      V n         R # rŠ   )r   ÚListenAuthenticatorrO   rE   r)   s   &r!   rP   ÚListenAuthenticatorTests.setUpY  s+   € Ü&×:Ò:Ó<ˆÔÜ"×,Ò,¨T×-?Ñ-?Ó@ˆŽr$   c                ó$  € V P                   pVP                  \        P                  ! 4       4       V P	                  RVP
                  4       VP                  R4       V P                  RVP                  4       V P                  RVP
                  4       V P                  RVP
                  4       V P                  RVP                  4       V P	                  RVP                  4       V P                  RVP                  P                  4       R# )r   Nr!  r   újabber:clientrX  r²   )r   rJ   r	   rK   r#  rÚ   rL   r   r¸   rS  ræ   rD   rÔ   rÓ   r[  r¹   s   & r!   r$  Ú)ListenAuthenticatorTests.test_streamStart]  sÉ   € ð
 �^‰^ˆØ
×Ñœ-×7Ò7Ó9Ô:Ø×Ñ˜T 2§6¡6Ô*Ø
�‰ðô	
ð 	×Ñ˜ §¡Ô,Ø×Ñ  b§f¡fÔ-Ø×Ñ˜G R§V¡VÔ,Ø×Ñ˜¨"¯,©,Ô7Ø×Ñ˜T 2§>¡>Ô2Ø×Ñ˜¨¯©×(:Ñ(:Ö;r$   c                óÈ   € V P                   pVP                  \        P                  ! 4       4       VP	                  R4       V P                  VP                  \        4       R# )z4
The generated session id must be a unicode object.
r!  N)r   rJ   r	   rK   rL   ÚassertIsInstancerÚ   Ústrr¹   s   & r!   Ú test_streamStartUnicodeSessionIDÚ9ListenAuthenticatorTests.test_streamStartUnicodeSessionIDr  sK   € ð �^‰^ˆØ
×Ñœ-×7Ò7Ó9Ô:Ø
�‰ðô	
ð 	×Ñ˜bŸf™f¤cÖ*r$   r1  N)
r4   r5   r6   r7   r8   rP   r$  rh  r9   r:   r;   s   @r!   r^  r^  T  s   ø‡ € ñòAò<÷*+ð +r$   r^  c                   ó˜   a € ] tR tRt o R tR tR t]! ]!  R 4       t	]! ]!  R 4       t
]! ]!  R 4       tR tR	 tR
 tR tR tRtV tR# )ÚTLSInitiatingInitializerTestsi�  c                óÊ  € . V n         . V n        \        P                  V n        \        P
                  ! R 4      V n        \        P                  ! V P                  4      V n        V P                   P                  V P                  n	        V P                  P                  4        V P                  P                  R4       \        P                  ! V P                  4      V n        R# )rX  rÞ   N)ÚoutputÚdoner   r   ÚsavedSSLrC   rO   rE   r  r[   r  rL   ÚTLSInitiatingInitializerrK  r)   s   &r!   rP   Ú#TLSInitiatingInitializerTests.setUp‚  s›   € ØˆŒØˆŒ	ä!Ÿ™ˆŒä&×;Ò;¸MÓJˆÔÜ"×,Ò,¨T×-?Ñ-?Ó@ˆŒØ"Ÿk™k×0Ñ0ˆ�‰ÔØ�‰×%Ñ%Ô'Ø�‰×#Ñ#ð;ô	
ô
 ×6Ò6°t·~±~ÓFˆŽ	r$   c                ó0   € V P                   \        n        R # rŠ   )ro  r   r   r)   s   &r!   ÚtearDownÚ&TLSInitiatingInitializerTests.tearDown“  s   € ØŸ™Œ	Žr$   c                óž   € \         P                  ! V P                   RR7      V n        V P                  V P                  P                  4       R# )z.
Passing required sets the instance variable.
T)ÚrequiredN)r   rp  rK  rU   rv  r)   s   &r!   Útest_initRequiredÚ/TLSInitiatingInitializerTests.test_initRequired–  s3   € ô ×6Ò6°t·~±~ÐPTÔUˆŒ	Ø�‰˜Ÿ	™	×*Ñ*Ö+r$   c                óÚ  a € \         P                  ! 4       S P                  n        V 3R lS P                  P                  n        V 3R lS P                  n        V 3R lS P                  n        S P                  P                  4       pVP                  S P                  \        P                  4       S P                  ^\        S P                  4      4       S P                  ^,          pS P                  RVP                  4       S P                  \        VP                   4       S P                  P#                  R\        ,          4       S P                  . ROS P$                  4       V# )z>
When TLS is wanted and SSL available, StartTLS is initiated.
c                 ó:   <€ SP                   P                  R 4      # )ÚTLS©rn  r  )Úctxr   s   &€r!   Ú<lambda>ÚDTLSInitiatingInitializerTests.test_wantedSupported.<locals>.<lambda>£  s   ø€ ¸¿	¹	×8HÑ8HÈÔ8Or$   c                  ó:   <€ S P                   P                  R 4      # ©rõ   r|  r)   s   €r!   r~  r  ¤  ó   ø€  t§y¡y×'7Ñ'7¸Ô'@r$   c                  ó:   <€ S P                   P                  R 4      # ©Úheaderr|  r)   s   €r!   r~  r  ¥  ó   ø€ ¨D¯I©I×,<Ñ,<¸XÔ,Fr$   Ústarttlsú<proceed xmlns='%s'/>©r{  rõ   r…  )r	   rK   r   rY   ÚstartTLSrõ   rÁ   rK  Ústartrh   r   ÚResetr  rm  ÚnameÚNS_XMPP_TLSÚurirL   rn  )r   ri   r‡  s   f  r!   Útest_wantedSupportedÚ2TLSInitiatingInitializerTests.test_wantedSupported�  sì   ø€ ô
 $1×#@Ò#@Ó#Bˆ�‰Ô Ü,Oˆ�‰× Ñ Ô)Ü@ˆ�‰ÔÜ$Fˆ�‰Ô!à�I‰I�O‰OÓˆØ	�‰�d×&Ñ&¬	¯©Ô8Ø×Ñ˜œC §¡Ó,Ô-Ø—;‘;˜q•>ˆØ×Ñ˜ X§]¡]Ô3Ø×Ñœ h§l¡lÔ3Ø�‰×#Ñ#Ð$;¼kÕ$IÔJØ×ÑÒ3°T·Y±YÔ?àˆr$   c                ó¢  a € V 3R lp\         P                  ! 4       S P                  n        VS P                  P                  n        V 3R lS P                  n        V 3R lS P                  n        S P                  P                  4       pS P                  P                  R\        ,          4       S P                  . ROS P                  4       V# )z*
The server certificate will be verified.
c                 ó¢   <€ SP                  V \        4       SP                  V P                  R 4       SP                  P                  R4       R# )rX  r{  N)rf  r   r   Ú	_hostnamern  r  )ÚcontextFactoryr   s   &€r!   ÚfakeStartTLSÚJTLSInitiatingInitializerTests.test_certificateVerify.<locals>.fakeStartTLS¸  s<   ø€ Ø×!Ñ! .Ô2BÔCØ×Ñ˜^×5Ñ5°}ÔEØ�I‰I×Ñ˜UÖ#r$   c                  ó:   <€ S P                   P                  R 4      # r�  r|  r)   s   €r!   r~  ÚFTLSInitiatingInitializerTests.test_certificateVerify.<locals>.<lambda>¿  r‚  r$   c                  ó:   <€ S P                   P                  R 4      # r„  r|  r)   s   €r!   r~  r™  À  r†  r$   rˆ  r‰  )r	   rK   r   rY   rŠ  rõ   rÁ   rK  r‹  rL   rŽ  r   rn  )r   r–  ri   s   f  r!   Útest_certificateVerifyÚ4TLSInitiatingInitializerTests.test_certificateVerify²  s‹   ø€ õ	$ô
 $1×#@Ò#@Ó#Bˆ�‰Ô Ø,8ˆ�‰× Ñ Ô)Ü@ˆ�‰ÔÜ$Fˆ�‰Ô!à�I‰I�O‰OÓˆØ�‰×#Ñ#Ð$;¼kÕ$IÔJØ×ÑÒ3°T·Y±YÔ?Øˆr$   c                ó*  a a€ \        4       o\        P                  ! S P                  SR7      S n        SS P                  n        VV 3R lp\
        P                  ! 4       S P                  n        VS P                  P                  n        V 3R lS P                  n	        V 3R lS P                  n
        S P                  P                  4       pS P                  P                  R\        ,          4       S P                  . ROS P                  4       V# )z8
A custom contextFactory is passed through to startTLS.
)ÚconfigurationForTLSc                 ób   <€ SP                  SV 4       SP                  P                  R 4       R# )r{  N)ÚassertIsrn  r  )r•  r}  r   s   &€€r!   r–  ÚQTLSInitiatingInitializerTests.test_certificateVerifyContext.<locals>.fakeStartTLSÓ  s#   ø€ Ø�M‰M˜#˜~Ô.Ø�I‰I×Ñ˜UÖ#r$   c                  ó:   <€ S P                   P                  R 4      # r�  r|  r)   s   €r!   r~  ÚMTLSInitiatingInitializerTests.test_certificateVerifyContext.<locals>.<lambda>Ù  r‚  r$   c                  ó:   <€ S P                   P                  R 4      # r„  r|  r)   s   €r!   r~  r£  Ú  r†  r$   rˆ  r‰  )r   r   rp  rK  r•  r	   rK   rY   rŠ  rõ   rÁ   r‹  rL   rŽ  r   rn  )r   r–  ri   r}  s   f  @r!   Útest_certificateVerifyContextÚ;TLSInitiatingInitializerTests.test_certificateVerifyContextÇ  s¾   ù€ ô
 !Ó"ˆÜ×6Ò6Ø�N‰N°ô
ˆŒ	ð $'ˆ�	‰	Ô ö	$ô $1×#@Ò#@Ó#Bˆ�‰Ô Ø,8ˆ�‰× Ñ Ô)Ü@ˆ�‰ÔÜ$Fˆ�‰Ô!à�I‰I�O‰OÓˆØ�‰×#Ñ#Ð$;¼kÕ$IÔJØ×ÑÒ3°T·Y±YÔ?Øˆr$   c                óô   € R\         n        RV P                  n        V P                  P	                  4       pVP                  V P                  R4       V P                  ^\        V P                  4      4       V# )zH
No StartTLS is initiated when wanted, not required, SSL not available.
NF)	r   r   rK  rv  r‹  rh   r   r  rm  r•   s   & r!   Ú"test_wantedNotSupportedNotRequiredÚ@TLSInitiatingInitializerTests.test_wantedNotSupportedNotRequiredá  sY   € ð Œ	ŒØ"ˆ�	‰	Ôà�I‰I�O‰OÓˆØ	�‰�d×&Ñ&¨Ô-Ø×Ñ˜œC §¡Ó,Ô-àˆr$   c                óü   € R\         n        RV P                  n        V P                  P	                  4       pV P                  V\         P                  4       V P                  ^\        V P                  4      4       V# )zC
TLSNotSupported is raised when TLS is required but not available.
NT)
r   r   rK  rv  r‹  rn   ÚTLSNotSupportedr   r  rm  r•   s   & r!   Útest_wantedNotSupportedRequiredÚ=TLSInitiatingInitializerTests.test_wantedNotSupportedRequiredî  s[   € ð Œ	ŒØ!ˆ�	‰	Ôà�I‰I�O‰OÓˆØ×Ñ˜1œi×7Ñ7Ô8Ø×Ñ˜œC §¡Ó,Ô-àˆr$   c                ó†  € \         P                  ! R4      pVP                  R4       VP                  VP                  3V/V P
                  n        RV P                  n        V P                  P                  4       pV P                  ^\        V P                  4      4       V P                  V\
        P                  4       V# )zG
TLSRequired is raised when TLS is not wanted, but required by server.
rv  F©r   r‡  )r   rý   Ú
addElementr�  r�  r   rü   rK  Úwantedr‹  r   r  rm  rn   ÚTLSRequired©r   Útlsri   s   &  r!   Útest_notWantedRequiredÚ4TLSInitiatingInitializerTests.test_notWantedRequiredû  s�   € ô �nŠnÐLÓMˆØ�‰�zÔ"Ø$'§G¡G¨S¯X©XÐ#6¸Ð"<ˆ�‰ÔØ ˆ�	‰	Ôà�I‰I�O‰OÓˆØ×Ñ˜œC §¡Ó,Ô-Ø×Ñ˜1œi×3Ñ3Ô4àˆr$   c                ó~  € \         P                  ! R4      pVP                  VP                  3V/V P                  n        RV P                  n        RV P                  n        V P                  P                  4       pVP                  V P                  R4       V P                  ^\        V P                  4      4       V# )z<
No StartTLS is initiated when not wanted and not required.
FNr¯  )r   rý   r�  r�  r   rü   rK  r±  rv  r‹  rh   r   r  rm  r³  s   &  r!   Útest_notWantedNotRequiredÚ7TLSInitiatingInitializerTests.test_notWantedNotRequired
  s‹   € ô �nŠnÐLÓMˆØ$'§G¡G¨S¯X©XÐ#6¸Ð"<ˆ�‰ÔØ ˆ�	‰	ÔØ"ˆ�	‰	Ôà�I‰I�O‰OÓˆØ	�‰�d×&Ñ&¨Ô-Ø×Ñ˜œC §¡Ó,Ô-Øˆr$   c                óÜ   € ^\         n        V P                  P                  4       pV P	                  V\         P
                  4       V P                   P                  R\        ,          4       V# )z>
TLSFailed is raised when the server responds with a failure.
z<failure xmlns='%s'/>)r   r   rK  r‹  rn   Ú	TLSFailedrL   rŽ  r•   s   & r!   Útest_failedÚ)TLSInitiatingInitializerTests.test_failed  sN   € ð Œ	Œà�I‰I�O‰OÓˆØ×Ñ˜1œi×1Ñ1Ô2Ø�‰×#Ñ#Ð$;¼kÕ$IÔJØˆr$   )rO   rn  rK  rm  ro  r   N)r4   r5   r6   r7   rP   rs  rw  r   ÚskipWhenNoSSLr�  r›  r¥  r¨  r¬  rµ  r¸  r¼  r9   r:   r;   s   @r!   rk  rk  �  s~   ø‡ € òGò"&ò,ñ ˆ]Ññó ðñ( ˆ]Ññó ðñ( ˆ]Ññó ðò2òòò÷ð r$   rk  c                   ó*   a € ] tR tRt o RtR tRtV tR# )ÚTestFeatureInitializeri'  c                ó.   € \         P                  ! R 4      # rŠ   )r   Úsucceedr)   s   &r!   r‹  ÚTestFeatureInitializer.start*  s   € Ü�}Š}˜TÓ"Ð"r$   r3   NrY  )r4   r5   r6   r7   Úfeaturer‹  r9   r:   r;   s   @r!   rÀ  rÀ  '  s   ø‡ € Ø €G÷#ð #r$   rÀ  c                   ó8   a € ] tR tRt o R tR tR tR tRtV t	R# )Ú%BaseFeatureInitiatingInitializerTestsi.  c                ó–   € \         P                  ! \         P                  ! 4       4      V n         \        V P                   4      V n        R # rŠ   )r   rE   rµ   rÀ  rK  r)   s   &r!   rP   Ú+BaseFeatureInitiatingInitializerTests.setUp/  s-   € Ü"×,Ò,¬Y×-DÒ-DÓ-FÓGˆŒÜ*¨4¯>©>Ó:ˆŽ	r$   c                óÔ   € V P                   P                  \        P                  ! V P                   P                  4      /V P                  n        V P                   P                  4       # )zG
Test that an advertized feature results in successful initialization.
)rK  rÄ  r   rý   r   rü   rD  r)   s   &r!   ÚtestAdvertizedÚ4BaseFeatureInitiatingInitializerTests.testAdvertized3  sE   € ð $(§9¡9×#4Ñ#4´f·n²nÀTÇYÁY×EVÑEVÓ6WÐ"Xˆ�‰ÔØ�y‰y×#Ñ#Ó%Ð%r$   c                ó�   € RV P                   n        V P                  \        P                  V P                   P
                  4       R# )zh
Test that when the feature is not advertized, but required by the
initializer, an exception is raised.
TN)rK  rv  r'   r   ÚFeatureNotAdvertizedrD  r)   s   &r!   ÚtestNotAdvertizedRequiredÚ?BaseFeatureInitiatingInitializerTests.testNotAdvertizedRequired:  s0   € ð
 "ˆ�	‰	ÔØ×Ñœ)×8Ñ8¸$¿)¹)×:NÑ:NÖOr$   c                ó|   € RV P                   n        V P                  RV P                   P                  4       4       R# )zw
Test that when the feature is not advertized, and not required by the
initializer, the initializer silently succeeds.
FN)rK  rv  r#  rD  r)   s   &r!   ÚtestNotAdvertizedNotRequiredÚBBaseFeatureInitiatingInitializerTests.testNotAdvertizedNotRequiredB  s-   € ð
 #ˆ�	‰	ÔØ×Ñ˜T 4§9¡9×#7Ñ#7Ó#9Ö:r$   )rK  r   N)
r4   r5   r6   r7   rP   rÊ  rÎ  rÑ  r9   r:   r;   s   @r!   rÆ  rÆ  .  s   ø‡ € ò;ò&òP÷;ð ;r$   rÆ  c                   óD   a € ] tR tRt o R tR tR tR tR tR t	Rt
V tR	# )
ÚToResponseTestsiK  c                ór  € \         P                  ! R4      pRVR&   RVR&   RVR&   RVR&   \        P                  ! VR	4      pV P	                  W4       V P                  VR,          R4       V P                  VR,          R4       V P                  VR,          R	4       V P                  VR,          R4       R
# )zC
Test that a response stanza is generated with addressing swapped.
rB   rS   úuser1@example.comÚtoúuser2@example.com/resourceÚfromÚstanza1rT   rd   N©rc  rN   )r   rý   r   Ú
toResponserS  r   ©r   ÚstanzaÚresponses   &  r!   Útest_toResponseÚToResponseTests.test_toResponseL  s«   € ô —’Ð 7Ó8ˆØˆˆv‰Ø*ˆˆt‰Ø5ˆˆv‰Ø ˆˆt‰Ü×'Ò'¨°Ó9ˆØ×Ñ Ô1Ø×Ñ˜ &Õ)Ð+>Ô?Ø×Ñ˜ $�Ð)EÔFØ×Ñ˜ &Õ)¨8Ô4Ø×Ñ˜ $�¨Ö3r$   c                óä   € \         P                  ! R4      pRVR&   RVR&   \        P                  ! V4      pV P	                  VR,          R4       V P                  VP                  R4      4       R# )zI
Test that a response is generated from a stanza without a from address.
rB   rS   rÖ  r×  rÙ  NrÛ  )r   rý   r   rÜ  r   rv   ÚhasAttributerÝ  s   &  r!   Útest_toResponseNoFromÚ%ToResponseTests.test_toResponseNoFrom\  sd   € ô —’Ð 7Ó8ˆØˆˆv‰Ø*ˆˆt‰Ü×'Ò'¨Ó/ˆØ×Ñ˜ &Õ)Ð+>Ô?Ø×Ñ˜×.Ñ.¨tÓ4Ö5r$   c                óä   € \         P                  ! R4      pRVR&   RVR&   \        P                  ! V4      pV P	                  VP                  R4      4       V P                  VR,          R4       R# )zG
Test that a response is generated from a stanza without a to address.
rB   rS   rØ  rÙ  r×  NrÛ  )r   rý   r   rÜ  rv   rã  r   rÝ  s   &  r!   Útest_toResponseNoToÚ#ToResponseTests.test_toResponseNoTog  sc   € ô —’Ð 7Ó8ˆØˆˆv‰Ø5ˆˆv‰Ü×'Ò'¨Ó/ˆØ×Ñ˜×.Ñ.¨vÓ6Ô7Ø×Ñ˜ $�Ð)EÖFr$   c                óè   € \         P                  ! R4      pRVR&   \        P                  ! V4      pV P	                  VP                  R4      4       V P	                  VP                  R4      4       R# )zI
Test that a response is generated from a stanza without any addressing.
ÚchatrS   r×  rÙ  N©rc  Úmessage©r   rý   r   rÜ  rv   rã  rÝ  s   &  r!   Útest_toResponseNoAddressingÚ+ToResponseTests.test_toResponseNoAddressingr  s^   € ô —’Ð <Ó=ˆØˆˆv‰Ü×'Ò'¨Ó/ˆØ×Ñ˜×.Ñ.¨tÓ4Ô5Ø×Ñ˜×.Ñ.¨vÓ6Ö7r$   c                óž   € \         P                  ! R4      p\        P                  ! V4      pV P	                  VP                  R4      4       R# )z@
Test that a proper response is generated without id attribute.
rT   Nrë  rí  rÝ  s   &  r!   Ú	test_noIDÚToResponseTests.test_noID|  s<   € ô —’Ð <Ó=ˆÜ×'Ò'¨Ó/ˆØ×Ñ˜×.Ñ.¨tÓ4Ö5r$   c                óž   € \         P                  ! R4      p\        P                  ! V4      pV P	                  VP                  R4      4       R# )zB
Test that a proper response is generated without type attribute.
rS   Nrë  rí  rÝ  s   &  r!   Útest_noTypeÚToResponseTests.test_noType„  s<   € ô —’Ð <Ó=ˆÜ×'Ò'¨Ó/ˆØ×Ñ˜×.Ñ.¨vÓ6Ö7r$   r3   N)r4   r5   r6   r7   rà  rä  rç  rî  rñ  rô  r9   r:   r;   s   @r!   rÔ  rÔ  K  s)   ø‡ € ò4ò 	6ò	Gò8ò6÷8ð 8r$   rÔ  c                   ó0   a € ] tR tRt o RtR tR tRtV tR# )ÚDummyFactoryi�  zB
Dummy XmlStream factory that only registers bootstrap observers.
c                ó   € / V n         R # rŠ   ©Ú	callbacksr)   s   &r!   Ú__init__ÚDummyFactory.__init__’  s	   € ØˆŽr$   c                ó"   € W P                   V&   R # rŠ   rù  )r   ÚeventÚcallbacks   &&&r!   ÚaddBootstrapÚDummyFactory.addBootstrap•  s   € Ø (�‰�uÓr$   rù  N)	r4   r5   r6   r7   r8   rû  r   r9   r:   r;   s   @r!   r÷  r÷  �  s   ø‡ € ñò÷)ð )r$   r÷  c                   óB   a € ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
ÚDummyXMPPHandleri™  zG
Dummy XMPP subprotocol handler to count the methods are called on it.
c                ó0   € ^ V n         ^ V n        ^ V n        R# )r´   N)ÚdoneMadeÚdoneInitializedÚdoneLostr)   s   &r!   rû  ÚDummyXMPPHandler.__init__ž  s   € ØˆŒØ ˆÔØˆŽr$   c                ó&   € V P                  4        R # rŠ   )r  r¹   s   &&r!   rJ   ÚDummyXMPPHandler.makeConnection£  s   € Ø×ÑÖr$   c                ó8   € V ;P                   ^,          un         R# ©r³   N©r  r)   s   &r!   r  ÚDummyXMPPHandler.connectionMade¦  ó   € Ø�Š˜Õ�r$   c                ó8   € V ;P                   ^,          un         R# r  )r  r)   s   &r!   ÚconnectionInitializedÚ&DummyXMPPHandler.connectionInitialized©  s   € Ø×Ò Õ!×r$   c                ó8   € V ;P                   ^,          un         R# r  )r  ©r   Úreasons   &&r!   r…   ÚDummyXMPPHandler.connectionLost¬  r  r$   )r  r  r  N)r4   r5   r6   r7   r8   rû  rJ   r  r  r…   r9   r:   r;   s   @r!   r  r  ™  s(   ø‡ € ñòò
òò"÷ð r$   r  c                   ó0   a € ] tR tRt o RtR tR tRtV tR# )ÚFailureReasonXMPPHandleri°  z6
Dummy handler specifically for failure Reason tests.
c                ó   € R V n         R# )FN©ÚgotFailureReasonr)   s   &r!   rû  Ú!FailureReasonXMPPHandler.__init__µ  s
   € Ø %ˆÖr$   c                óX   € \        V\        P                  4      '       d
   R V n        R# R# r¡   )Ú
isinstancer   ÚFailurer  r  s   &&r!   r…   Ú'FailureReasonXMPPHandler.connectionLost¸  s    € Ü�fœgŸo™o×.Ò.Ø$(ˆDÖ!ñ /r$   r  N)	r4   r5   r6   r7   r8   rû  r…   r9   r:   r;   s   @r!   r  r  °  s   ø‡ € ñò&÷)ð )r$   r  c                   ó<   a € ] tR tRt o RtR tR tR tR tRt	V t
R# )	ÚXMPPHandlerTestsi½  z%
Tests for L{xmlstream.XMPPHandler}.
c                ó`   € \        \        P                  \        P                  ! 4       4       R# )z>
L{xmlstream.XMPPHandler} implements L{ijabber.IXMPPHandler}.
N)r   r   ÚIXMPPHandlerr   ÚXMPPHandlerr)   s   &r!   Útest_interfaceÚXMPPHandlerTests.test_interfaceÂ  s   € ô 	”W×)Ñ)¬9×+@Ò+@Ó+BÖCr$   c                óÌ   €  ! R R4      p\         P                  ! 4       pV! 4       Vn        VP                  R4       V P	                  R.VP                  P
                  4       R# )z@
Test that data is passed on for sending by the stream manager.
c                   ó,   a € ] tR tRt o R tR tRtV tR# )Ú6XMPPHandlerTests.test_send.<locals>.DummyStreamManageriÍ  c                ó   € . V n         R # rŠ   ©Úoutlistr)   s   &r!   rû  Ú?XMPPHandlerTests.test_send.<locals>.DummyStreamManager.__init__Î  s	   € Ø!�–r$   c                ó<   € V P                   P                  V4       R # rŠ   )r-  r  )r   Údatas   &&r!   r[   Ú;XMPPHandlerTests.test_send.<locals>.DummyStreamManager.sendÑ  s   € Ø—‘×#Ñ# DÖ)r$   r,  N)r4   r5   r6   r7   rû  r[   r9   r:   r;   s   @r!   ÚDummyStreamManagerr*  Í  s   ø‡ € ò"÷*ð *r$   r2  rù   N)r   r%  Úparentr[   r   r-  )r   r2  Úhandlers   &  r!   rÿ   ÚXMPPHandlerTests.test_sendÈ  sN   € ÷
	*ñ 	*ô ×'Ò'Ó)ˆÙ+Ó-ˆŒØ�‰�]Ô#Ø×Ñ˜-˜¨'¯.©.×*@Ñ*@ÖAr$   c                ó&  €  ! R R\         P                  4      pV! 4       p\         P                  ! \         P                  ! 4       4      pVP	                  V4       V P                  VP                  4       V P                  W2P                   4       R# )zI
Test that makeConnection saves the XML stream and calls connectionMade.
c                   ó&   a € ] tR tRt o R tRtV tR# )Ú=XMPPHandlerTests.test_makeConnection.<locals>.TestXMPPHandleriÞ  c                ó   € R V n         R# r¡   r  r)   s   &r!   r  ÚLXMPPHandlerTests.test_makeConnection.<locals>.TestXMPPHandler.connectionMadeß  s	   € Ø $�–r$   r  N)r4   r5   r6   r7   r  r9   r:   r;   s   @r!   ÚTestXMPPHandlerr8  Þ  s   ø‡ € ÷%ð %r$   r;  N)r   r%  rE   rµ   rJ   rU   r  r#  )r   r;  r4  rj   s   &   r!   Útest_makeConnectionÚ$XMPPHandlerTests.test_makeConnectionÙ  sk   € ô
	%œi×3Ñ3ô 	%ñ "Ó#ˆÜ× Ò ¤×!8Ò!8Ó!:Ó;ˆØ×Ñ˜rÔ"Ø�‰˜×(Ñ(Ô)Ø×Ñ˜R×!2Ñ!2Ö3r$   c                ó  € \         P                  ! 4       p\         P                  ! \         P                  ! 4       4      pVP	                  V4       VP                  \        4       4       V P                  RVP                   4       R# )z2
Test that connectionLost forgets the XML stream.
N)r   r%  rE   rµ   rJ   r…   Ú	Exceptionr#  )r   r4  rj   s   &  r!   Útest_connectionLostÚ$XMPPHandlerTests.test_connectionLostè  s_   € ô ×'Ò'Ó)ˆÜ× Ò ¤×!8Ò!8Ó!:Ó;ˆØ×Ñ˜rÔ"Ø×Ñœy›{Ô+Ø×Ñ˜T 7×#4Ñ#4Ö5r$   r3   N)r4   r5   r6   r7   r8   r&  rÿ   r<  r@  r9   r:   r;   s   @r!   r"  r"  ½  s%   ø‡ € ñòDòBò"4÷6ð 6r$   r"  c                   ó<   a € ] tR tRt o RtR tR tR tR tRt	V t
R# )	ÚXMPPHandlerCollectionTestsió  z/
Tests for L{xmlstream.XMPPHandlerCollection}.
c                ó:   € \         P                  ! 4       V n        R # rŠ   )r   ÚXMPPHandlerCollectionÚ
collectionr)   s   &r!   rP   Ú XMPPHandlerCollectionTests.setUpø  s   € Ü#×9Ò9Ó;ˆŽr$   c                óN   € \        \        P                  V P                  4       R# )zJ
L{xmlstream.StreamManager} implements L{ijabber.IXMPPHandlerCollection}.
N)r   r   ÚIXMPPHandlerCollectionrF  r)   s   &r!   r&  Ú)XMPPHandlerCollectionTests.test_interfaceû  s   € ô 	”W×3Ñ3°T·_±_ÖEr$   c                óÒ   € \        4       pVP                  V P                  4       V P                  WP                  4       V P	                  V P                  VP
                  4       R# )z*
Test the addition of a protocol handler.
N)r  ÚsetHandlerParentrF  r]   r#  r3  ©r   r4  s   & r!   Útest_addHandlerÚ*XMPPHandlerCollectionTests.test_addHandler  sF   € ô #Ó$ˆØ× Ñ  §¡Ô1Ø�‰�gŸ™Ô/Ø×Ñ˜TŸ_™_¨g¯n©nÖ=r$   c                óô   € \        4       pVP                  V P                  4       VP                  V P                  4       V P	                  WP                  4       V P                  RVP                  4       R# )z%
Test removal of a protocol handler.
N)r  rL  rF  ÚdisownHandlerParentr€   r#  r3  rM  s   & r!   Útest_removeHandlerÚ-XMPPHandlerCollectionTests.test_removeHandler
  sV   € ô #Ó$ˆØ× Ñ  §¡Ô1Ø×#Ñ# D§O¡OÔ4Ø×Ñ˜§/¡/Ô2Ø×Ñ˜T 7§>¡>Ö2r$   )rF  N)r4   r5   r6   r7   r8   rP   r&  rN  rR  r9   r:   r;   s   @r!   rC  rC  ó  s$   ø‡ € ñò<òFò>÷3ð 3r$   rC  c                   óx   a € ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tRtV tR# )ÚStreamManagerTestsi  z'
Tests for L{xmlstream.StreamManager}.
c                óP   € \        4       p\        P                  ! V4      V n        R # rŠ   )r÷  r   ÚStreamManagerÚstreamManager)r   Úfactorys   & r!   rP   ÚStreamManagerTests.setUp  s   € Ü“.ˆÜ&×4Ò4°WÓ=ˆÖr$   c                óF  € V P                   pV P                  RVP                  4       V P                  . VP                  4       V P                  VP
                  VP                  P                  R,          4       V P                  VP                  VP                  P                  R,          4       V P                  VP                  VP                  P                  R,          4       V P                  VP                  VP                  P                  R,          4       R# )z=
Test correct initialization and setup of factory observers.
Nz//event/stream/connectedr5  r±   r6  )rX  r#  r   r   ÚhandlersÚ
_connectedrY  rú  Ú_authdÚ_disconnectedÚinitializationFailed)r   Úsms   & r!   r"   ÚStreamManagerTests.test_basic  sÓ   € ð ×ÑˆØ×Ñ˜T 2§<¡<Ô0Ø×Ñ˜˜RŸ[™[Ô)Ø×ÑØ�M‰M˜2Ÿ:™:×/Ñ/Ð0JÕKô	
ð 	×Ñ˜Ÿ™ B§J¡J×$8Ñ$8Ð9OÕ$PÔQØ×Ñ˜×)Ñ)¨2¯:©:×+?Ñ+?Ð@TÕ+UÔVØ×ÑØ×#Ñ# R§Z¡Z×%9Ñ%9Ð:SÕ%Tö	
r$   c                óp  € V P                   p\        4       pVP                  V4       \        P                  ! \        P
                  ! 4       4      pVP                  V4       V P                  ^VP                  4       V P                  ^ VP                  4       V P                  ^ VP                  4       R# )zg
Test that protocol handlers have their connectionMade method called
when the XML stream is connected.
N)rX  r  rL  r   rE   rµ   r]  r   r  r  r  ©r   ra  r4  rj   s   &   r!   Útest_connectedÚ!StreamManagerTests.test_connected.  sŒ   € ð
 ×ÑˆÜ"Ó$ˆØ× Ñ  Ô$Ü× Ò ¤×!8Ò!8Ó!:Ó;ˆØ
�‰�bÔØ×Ñ˜˜G×,Ñ,Ô-Ø×Ñ˜˜G×3Ñ3Ô4Ø×Ñ˜˜G×,Ñ,Ö-r$   c                ó8  € V P                   p\        4       pVP                  V4       \        P                  ! \        P
                  ! 4       4      pVP                  V4       V P                  RVP                  4       V P                  RVP                  4       R# )z@
Test raw data functions unset when logTraffic is set to False.
N)
rX  r  rL  r   rE   rµ   r]  r#  ÚrawDataInFnÚrawDataOutFnrd  s   &   r!   Útest_connectedLogTrafficFalseÚ0StreamManagerTests.test_connectedLogTrafficFalse<  sr   € ð ×ÑˆÜ"Ó$ˆØ× Ñ  Ô$Ü× Ò ¤×!8Ò!8Ó!:Ó;ˆØ
�‰�bÔØ×Ñ˜T 2§>¡>Ô2Ø×Ñ˜T 2§?¡?Ö3r$   c                óF  € V P                   pRVn        \        4       pVP                  V4       \        P
                  ! \        P                  ! 4       4      pVP                  V4       V P                  RVP                  4       V P                  RVP                  4       R# )z=
Test raw data functions set when logTraffic is set to True.
TN)rX  Ú
logTrafficr  rL  r   rE   rµ   r]  rS  rh  ri  rd  s   &   r!   Útest_connectedLogTrafficTrueÚ/StreamManagerTests.test_connectedLogTrafficTrueH  sy   € ð ×ÑˆØˆŒÜ"Ó$ˆØ× Ñ  Ô$Ü× Ò ¤×!8Ò!8Ó!:Ó;ˆØ
�‰�bÔØ×Ñ  b§n¡nÔ5Ø×Ñ  b§o¡oÖ6r$   c                óp  € V P                   p\        4       pVP                  V4       \        P                  ! \        P
                  ! 4       4      pVP                  V4       V P                  ^ VP                  4       V P                  ^VP                  4       V P                  ^ VP                  4       R# )zp
Test that protocol handlers have their connectionInitialized method
called when the XML stream is initialized.
N)rX  r  rL  r   rE   rµ   r^  r   r  r  r  rd  s   &   r!   Ú
test_authdÚStreamManagerTests.test_authdU  s‹   € ð
 ×ÑˆÜ"Ó$ˆØ× Ñ  Ô$Ü× Ò ¤×!8Ò!8Ó!:Ó;ˆØ
�	‰	�"ŒØ×Ñ˜˜G×,Ñ,Ô-Ø×Ñ˜˜G×3Ñ3Ô4Ø×Ñ˜˜G×,Ñ,Ö-r$   c                óp  € V P                   p\        4       pVP                  V4       \        P                  ! \        P
                  ! 4       4      pVP                  V4       V P                  ^ VP                  4       V P                  ^ VP                  4       V P                  ^VP                  4       R# )zj
Test that protocol handlers have their connectionLost method
called when the XML stream is disconnected.
N)rX  r  rL  r   rE   rµ   r_  r   r  r  r  rd  s   &   r!   Útest_disconnectedÚ$StreamManagerTests.test_disconnectedc  sŽ   € ð
 ×ÑˆÜ"Ó$ˆØ× Ñ  Ô$Ü× Ò ¤×!8Ò!8Ó!:Ó;ˆØ
×Ñ˜ÔØ×Ñ˜˜G×,Ñ,Ô-Ø×Ñ˜˜G×3Ñ3Ô4Ø×Ñ˜˜G×,Ñ,Ö-r$   c                óè   € V P                   p\        4       pVP                  V4       VP                  \        P
                  ! \        R4      4      4       V P                  RVP                  4       R# )z‡
A L{STREAM_END_EVENT} results in L{StreamManager} firing the handlers
L{connectionLost} methods, passing a L{failure.Failure} reason.
z	no reasonTN)	rX  r  rL  r_  r   r  r?  r   r  ©r   ra  r4  s   &  r!   Útest_disconnectedReasonÚ*StreamManagerTests.test_disconnectedReasonq  sW   € ð
 ×ÑˆÜ*Ó,ˆØ× Ñ  Ô$Ø
×ÑœŸš¬°;Ó)?Ó@ÔAØ×Ñ˜˜w×7Ñ7Ö8r$   c                óü   € V P                   p\        4       pVP                  V4       V P                  ^ VP                  4       V P                  ^ VP
                  4       V P                  ^ VP                  4       R# )z>
Test the addition of a protocol handler while not connected.
N)rX  r  rL  r   r  r  r  rw  s   &  r!   rN  Ú"StreamManagerTests.test_addHandler|  sg   € ð ×ÑˆÜ"Ó$ˆØ× Ñ  Ô$à×Ñ˜˜G×,Ñ,Ô-Ø×Ñ˜˜G×3Ñ3Ô4Ø×Ñ˜˜G×,Ñ,Ö-r$   c                ó’  € V P                   p\        P                  ! \        P                  ! 4       4      pVP	                  V4       VP                  V4       \        4       pVP                  V4       V P                  ^VP                  4       V P                  ^VP                  4       V P                  ^ VP                  4       R# )zÓ
Test the addition of a protocol handler after the stream
have been initialized.

Make sure that the handler will have the connected stream
passed via C{makeConnection} and have C{connectionInitialized}
called.
N)rX  r   rE   rµ   r]  r^  r  rL  r   r  r  r  )r   ra  rj   r4  s   &   r!   Útest_addHandlerInitializedÚ-StreamManagerTests.test_addHandlerInitializedˆ  s—   € ð ×ÑˆÜ× Ò ¤×!8Ò!8Ó!:Ó;ˆØ
�‰�bÔØ
�	‰	�"ŒÜ"Ó$ˆØ× Ñ  Ô$à×Ñ˜˜G×,Ñ,Ô-Ø×Ñ˜˜G×3Ñ3Ô4Ø×Ñ˜˜G×,Ñ,Ö-r$   c                ó¶  € \         P                  ! \         P                  ! 4       4      p\         P                  ! V4      pVP	                  R4      p\
        P                  ! 4       Vn        VP                  4        VP                  R4       VP                  VR4       VP                  R4       V P                  RVP                  P                  4       4       R# )zh
Test send when the stream has been initialized.

The data should be sent directly over the XML stream.
Nr  r5  rù   rú   )r   ÚXmlStreamFactoryrµ   rW  ÚbuildProtocolr	   rK   rY   r  rL   Údispatchr[   r   r^   ©r   rY  ra  rj   s   &   r!   Útest_sendInitializedÚ'StreamManagerTests.test_sendInitializedœ  s¤   € ô ×,Ò,¬Y×-DÒ-DÓ-FÓGˆÜ×$Ò$ WÓ-ˆØ×"Ñ" 4Ó(ˆÜ$×4Ò4Ó6ˆŒØ
×ÑÔØ
�‰ð-ô	
ð
 	�‰�BÐ.Ô/Ø
�‰�ÔØ×Ñ˜¨¯©×);Ñ);Ó)=Ö>r$   c                óV  € \         P                  ! \         P                  ! 4       4      p\         P                  ! V4      p\	        4       pVP                  V4       VP                  R4      p\        P                  ! 4       Vn	        VP                  R4       V P                  RVP                  P                  4       4       V P                  RVP                  ^ ,          4       VP                  4        V P                  RVP                  P                  4       4       V P                  RVP                  ^ ,          4       VP                  R4       VP!                  VR4       V P                  RVP                  P                  4       4       V P#                  VP                  4       R# )z‰
Test send when there is no established XML stream.

The data should be cached until an XML stream has been established and
initialized.
Nrù   r$   r  r5  rú   )r   r€  rµ   rW  r  Ú
addHandlerr�  r	   rK   rY   r[   r   r^   Ú_packetQueuer  rL   r‚  rv   ©r   rY  ra  r4  rj   s   &    r!   Útest_sendNotConnectedÚ(StreamManagerTests.test_sendNotConnected°  s6  € ô ×,Ò,¬Y×-DÒ-DÓ-FÓGˆÜ×$Ò$ WÓ-ˆÜ"Ó$ˆØ
�‰�gÔà×"Ñ" 4Ó(ˆÜ$×4Ò4Ó6ˆŒØ
�‰�ÔØ×Ñ˜˜bŸl™l×0Ñ0Ó2Ô3Ø×Ñ˜¨¯©¸Õ(:Ô;à
×ÑÔØ×Ñ˜˜bŸl™l×0Ñ0Ó2Ô3Ø×Ñ˜¨¯©¸Õ(:Ô;à
�‰ð-ô	
ð
 	�‰�BÐ.Ô/à×Ñ˜¨¯©×);Ñ);Ó)=Ô>Ø×Ñ˜Ÿ™Ö)r$   c                óØ  € \         P                  ! \         P                  ! 4       4      p\         P                  ! V4      pVP	                  R4      p\
        P                  ! 4       Vn        VP                  4        VP                  R4       VP                  R4       V P                  RVP                  P                  4       4       V P                  RVP                  ^ ,          4       R# )z‡
Test send when the stream is connected but not yet initialized.

The data should be cached until the XML stream has been initialized.
Nr  rù   r$   )r   r€  rµ   rW  r�  r	   rK   rY   r  rL   r[   r   r^   rˆ  rƒ  s   &   r!   Útest_sendNotInitializedÚ*StreamManagerTests.test_sendNotInitializedÐ  s®   € ô ×,Ò,¬Y×-DÒ-DÓ-FÓGˆÜ×$Ò$ WÓ-ˆØ×"Ñ" 4Ó(ˆÜ$×4Ò4Ó6ˆŒØ
×ÑÔØ
�‰ð-ô	
ð
 	�‰�ÔØ×Ñ˜˜bŸl™l×0Ñ0Ó2Ô3Ø×Ñ˜¨¯©¸Õ(:Ö;r$   c                ó  € \         P                  ! \         P                  ! 4       4      p\         P                  ! V4      p\	        4       pVP                  V4       VP                  R4      pVP                  4        \        P                  ! 4       Vn
        VP                  R4       VP                  R4       V P                  RVP                  P                  4       4       V P                  RVP                  ^ ,          4       R# )zƒ
Test send after XML stream disconnection.

The data should be cached until a new XML stream has been established
and initialized.
Nrù   r$   )r   r€  rµ   rW  r  r‡  r�  r  r	   rK   rY   r…   r[   r   r^   rˆ  r‰  s   &    r!   Útest_sendDisconnectedÚ(StreamManagerTests.test_sendDisconnectedä  s½   € ô ×,Ò,¬Y×-DÒ-DÓ-FÓGˆÜ×$Ò$ WÓ-ˆÜ"Ó$ˆØ
�‰�gÔà×"Ñ" 4Ó(ˆØ
×ÑÔÜ$×4Ò4Ó6ˆŒØ
×Ñ˜$Ôà
�‰�ÔØ×Ñ˜˜bŸl™l×0Ñ0Ó2Ô3Ø×Ñ˜¨¯©¸Õ(:Ö;r$   )rX  N)r4   r5   r6   r7   r8   rP   r"   re  rj  rn  rq  rt  rx  rN  r}  r„  rŠ  r�  r�  r9   r:   r;   s   @r!   rU  rU    sV   ø‡ € ñò>ò
ò .ò
4ò7ò.ò.ò	9ò
.ò.ò(?ò(*ò@<÷(<ð <r$   rU  c                   óB   a € ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
ÚXmlStreamServerFactoryTestsiú  z0
Tests for L{xmlstream.XmlStreamServerFactory}.
c                ó^   a€  ! R R4      oV3R lp\         P                  ! V4      V n        R# )zA
Set up a server factory with an authenticator factory function.
c                   ó,   a € ] tR tRt o R tR tRtV tR# )Ú<XmlStreamServerFactoryTests.setUp.<locals>.TestAuthenticatori  c                ó   € . V n         R # rŠ   ©Ú
xmlstreamsr)   s   &r!   rû  ÚEXmlStreamServerFactoryTests.setUp.<locals>.TestAuthenticator.__init__  s	   € Ø"$�–r$   c                ó<   € V P                   P                  V4       R # rŠ   )r™  r  r¹   s   &&r!   r  ÚPXmlStreamServerFactoryTests.setUp.<locals>.TestAuthenticator.associateWithStream  s   € Ø—‘×&Ñ& rÖ*r$   r˜  N)r4   r5   r6   r7   rû  r  r9   r:   r;   s   @r!   r  r–    s   ø‡ € ò%÷+ð +r$   r  c                  ó   <€ S ! 4       # rŠ   r3   )r  s   €r!   ÚauthenticatorFactoryÚ?XmlStreamServerFactoryTests.setUp.<locals>.authenticatorFactory  s   ø€ Ù$Ó&Ð&r$   N)r   ÚXmlStreamServerFactoryrY  )r   rž  r  s   & @r!   rP   Ú!XmlStreamServerFactoryTests.setUpÿ  s'   ø€ ÷
	+ñ 	+õ	'ô !×7Ò7Ð8LÓMˆŽr$   c                ó:   € \        \        V P                  4       R# )z,
L{XmlStreamServerFactory} is a L{Factory}.
N)r   r   rY  r)   s   &r!   r&  Ú*XmlStreamServerFactoryTests.test_interface  s   € ô 	Ô% t§|¡|Ö4r$   c                óŠ   € V P                   P                  R4      pV P                  V.VP                  P                  4       R# )aS  
The authenticator factory should be used to instantiate the
authenticator and pass it to the protocol.

The default protocol, L{XmlStream} stores the authenticator it is
passed, and calls its C{associateWithStream} method. so we use that to
check whether our authenticator factory is used and the protocol
instance gets an authenticator.
N)rY  r�  r   rO   r™  r¹   s   & r!   Ú,test_buildProtocolAuthenticatorInstantiationÚHXmlStreamServerFactoryTests.test_buildProtocolAuthenticatorInstantiation  s6   € ð �\‰\×'Ñ'¨Ó-ˆØ×Ñ˜"˜˜r×/Ñ/×:Ñ:Ö;r$   c                ó|   € V P                   P                  R4      pV P                  V\        P                  4       R# )zF
The protocol factory creates Jabber XML Stream protocols by default.
N)rY  r�  rf  r   rE   r¹   s   & r!   Útest_buildProtocolXmlStreamÚ7XmlStreamServerFactoryTests.test_buildProtocolXmlStream#  s.   € ð �\‰\×'Ñ'¨Ó-ˆØ×Ñ˜b¤)×"5Ñ"5Ö6r$   c                óà   € V P                   P                  R4      pV P                   P                  R4      pV P                  W4       V P                  VP                  VP                  4       R# )zz
Subsequent calls to buildProtocol should result in different instances
of the protocol, as well as their authenticators.
N)rY  r�  rS  rO   )r   Úxs1Úxs2s   &  r!   Útest_buildProtocolTwiceÚ3XmlStreamServerFactoryTests.test_buildProtocolTwice*  sV   € ð
 �l‰l×(Ñ(¨Ó.ˆØ�l‰l×(Ñ(¨Ó.ˆØ×Ñ Ô)Ø×Ñ × 1Ñ 1°3×3DÑ3DÖEr$   )rY  N)r4   r5   r6   r7   r8   rP   r&  r¥  r¨  r­  r9   r:   r;   s   @r!   r“  r“  ú  s+   ø‡ € ñòNò"5ò<ò7÷Fð Fr$   r“  )FÚ )TzSSL not available)9r8   r
   r   Úzope.interface.verifyr   Útwisted.internetr   r   Útwisted.internet.errorr   Útwisted.internet.interfacesr   Útwisted.pythonr   Útwisted.testr	   Útwisted.trialÚtwisted.words.protocols.jabberr   r   r   r   Ú!twisted.words.test.test_xmlstreamr   Útwisted.words.xishr   r   Ú_sslr¾  Útwisted.internet._sslverifyr   Útwisted.internet.sslr   ÚImportErrorrŽ  ÚTestCaser   r>   rŸ   r?  r  r  r3  r^  rk  Ú BaseFeatureInitiatingInitializerrÀ  rÆ  rÔ  r÷  r%  r  r  r"  rC  rU  r“  r3   r$   r!   Ú<module>rÀ     s·  ðñõ å .ç (Ý 1Ý 8Ý "Ý &Ý "ß IÓ IÝ OÝ %ð	8Ý,ð
 €CØ€MÝ<Ý7à/€ôK˜×)Ñ)ô Kô@_ˆh×Ñô _ôDX6�X×&Ñ&ô X6ôv	�	ô 	ô@-˜×*Ñ*ô @-ôFI/ × 1Ñ 1ô I/ôX*+˜x×0Ñ0ô *+ôZc H×$5Ñ$5ô côL#˜Y×GÑGô #ô;¨H×,=Ñ,=ô ;ô:?8�h×'Ñ'ô ?8÷D	)ñ 	)ô�y×,Ñ,ô ô.
)˜y×4Ñ4ô 
)ô36�x×(Ñ(ô 36ôl3 ×!2Ñ!2ô 3ôDb<˜×*Ñ*ô b<ôJ8FÐ"Cö 8FøðE' ô 0Ø
€CØ/ƒMð0ús   ÁG ÇGÇG