+
    üÐj…  ã                   óŠ  € R t ^ RIHt ^ RIHt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^ R
IHt  ! R R]P0                  4      t ! R R4      t]! ]P6                  4       ! R R]4      4       t ! R R]]]4      t]! 4       P?                  ]PA                  4       4       R	#   ] d    R	t Lƒi ; i)z(
Tests for L{twisted.internet._newtls}.
)Ú
interfaces)ÚConnectableProtocolÚrunProtocolsWithReactor)ÚReactorBuilder)Ú
TCPCreator)ÚContextGeneratingMixinÚ
SSLCreatorÚStartTLSClientCreatorÚTLSMixin)Úunittest)Ú_newtls)ÚtlsN)Úimplementerc                   ó>   a € ] tR t^"t o Rt]'       g   RtR tRtV t	R# )ÚBypassTLSTestsz,
Tests for the L{_newtls._BypassTLS} class.
z<Couldn't import _newtls, perhaps pyOpenSSL is old or missingc                ó  aa€ \        4       o. o ! VV3R lR4      p\        P                  W! 4       4      pVP                  4        V P	                  SS.4       \        4       pVP                  V4       V P	                  SSV.4       R# )z¤
C{_BypassTLS.loseConnection} calls C{loseConnection} on the base
class, while preserving any default argument in the base class'
C{loseConnection} implementation.
c                   ó6   <a € ] tR t^3t o  Z3V3R lltRtV tR# )ÚDBypassTLSTests.test_loseConnectionPassThrough.<locals>.FakeTransportc                ó*   <€ SP                  V4       R # ©N)Úappend)ÚselfÚ	_connDoneÚresults   &&€ÚC/usr/lib/python3/dist-packages/twisted/internet/test/test_newtls.pyÚloseConnectionÚSBypassTLSTests.test_loseConnectionPassThrough.<locals>.FakeTransport.loseConnection4   s   ø€ Ø—‘˜iÖ(ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__Údefaultr   s   @€€r   ÚFakeTransportr   3   s   ù‡ € Ù/6÷ )õ )r   r'   N)Úobjectr   Ú
_BypassTLSr   ÚassertEqual)r   r'   ÚbypassÚ
notDefaultr&   r   s   &   @@r   Útest_loseConnectionPassThroughÚ-BypassTLSTests.test_loseConnectionPassThrough*   s}   ù€ ô “(ˆØˆ÷	)õ 	)ô ×#Ñ# M°=³?ÓCˆð 	×ÑÔØ×Ñ˜ ' Ô+ô “Xˆ
Ø×Ñ˜jÔ)Ø×Ñ˜ '¨:Ð!6Ö7r   r   N)
r   r    r!   r"   Ú__doc__r   Úskipr-   r#   r$   ©r%   s   @r   r   r   "   s   ø‡ € ñ÷ ØMˆ÷8ð 8r   r   c                   ó6   a € ] tR t^Ct o RtR tR tR tRtV t	R# )ÚFakeProducerz
A producer that does nothing.
c                ó   € R # r   r   ©r   s   &r   ÚpauseProducingÚFakeProducer.pauseProducingH   ó   € Ùr   c                ó   € R # r   r   r5   s   &r   ÚresumeProducingÚFakeProducer.resumeProducingK   r8   r   c                ó   € R # r   r   r5   s   &r   ÚstopProducingÚFakeProducer.stopProducingN   r8   r   r   N)
r   r    r!   r"   r/   r6   r:   r=   r#   r$   r1   s   @r   r3   r3   C   s   ø‡ € ñòò÷ð r   r3   c                   ó0   a € ] tR t^Rt o RtR tR tRtV tR# )ÚProducerProtocolzm
Register a producer, unregister it, and verify the producer hooks up to
innards of C{TLSMemoryBIOProtocol}.
c                ó   € Wn         W n        R # r   ©Úproducerr   )r   rC   r   s   &&&r   Ú__init__ÚProducerProtocol.__init__Y   s   € Ø ŒØŽr   c                ó0  € \        V P                  P                  \        P                  4      '       g   \        R 4      hV P                  P                  V P                  R4       V P                  P                  V P                  P                  P                  P                  4       V P                  P                  4        V P                  P                  V P                  P                  P                  4       V P                  P                  4        R# )z#TLSMemoryBIOProtocol not hooked up.TN)Ú
isinstanceÚ	transportÚprotocolr   ÚBufferingTLSTransportÚRuntimeErrorÚregisterProducerrC   r   r   Ú	_producerÚunregisterProducerr   r5   s   &r   ÚhandshakeCompletedÚ#ProducerProtocol.handshakeCompleted]   s­   € Ü˜$Ÿ.™.×1Ñ1´3×3LÑ3L×MÒMäÐDÓEÐEà�‰×'Ñ'¨¯©°tÔ<à�‰×Ñ˜4Ÿ>™>×2Ñ2×<Ñ<×FÑFÔGà�‰×)Ñ)Ô+à�‰×Ñ˜4Ÿ>™>×2Ñ2×<Ñ<Ô=Ø�‰×%Ñ%Ö'r   rB   N)	r   r    r!   r"   r/   rD   rO   r#   r$   r1   s   @r   r@   r@   R   s   ø‡ € ñò
÷(ð (r   r@   c                   óV   a € ] tR t^lt o Rt]'       g   RtR tR tR t	R t
R tRtV tR	# )
ÚProducerTestsMixinzE
Test the new TLS code integrates C{TLSMemoryBIOProtocol} correctly.
z)Could not import twisted.internet._newtlsc                ó’   € . p\        4       p\        V \        4       \        W!4      \	        4       4       V P                  WR.4       R# )z²
C{registerProducer} and C{unregisterProducer} on TLS transports
created as SSL from the get go are passed to the
C{TLSMemoryBIOProtocol}, not the underlying transport directly.
N)r3   r   r   r@   r   r*   ©r   r   rC   s   &  r   Útest_producerSSLFromStartÚ,ProducerTestsMixin.test_producerSSLFromStartt   sC   € ð ˆÜ“>ˆäØÜÓ!Ü˜XÓ.Ü‹Lô		
ð 	×Ñ˜¨DÐ!1Ö2r   c                ó’   € . p\        4       p\        V \        4       \        W!4      \	        4       4       V P                  WR.4       R# )zª
C{registerProducer} and C{unregisterProducer} on TLS transports
created by C{startTLS} are passed to the C{TLSMemoryBIOProtocol}, not
the underlying transport directly.
N)r3   r   r   r@   r	   r*   rT   s   &  r   Útest_producerAfterStartTLSÚ-ProducerTestsMixin.test_producerAfterStartTLS…   sD   € ð ˆÜ“>ˆäØÜÓ!Ü˜XÓ.Ü!Ó#ô		
ð 	×Ñ˜¨DÐ!1Ö2r   c                ó  aaaaa€ V P                  4       oV P                  4       o. o\        4       o ! VVVV3R lR\        4      p ! V3R lR\        4      p\	        W! 4       V! 4       \        4       4       V P                  SSS.4       R# )z}
When a producer is registered, and then startTLS is called,
the producer is re-registered with the C{TLSMemoryBIOProtocol}.
c                   ó4   <a € ] tR t^ t o VVVV3R ltRtV tR# )ÚMProducerTestsMixin.startTLSAfterRegisterProducer.<locals>.RegisterTLSProtocolc                ó¸  <€ V P                   P                  SS4       V P                   P                  S4       S'       dj   SP                  V P                   P                  P
                  P
                  4       SP                  V P                   P                  P
                  4       M|SP                  V P                   P                  P
                  P
                  P
                  4       SP                  V P                   P                  P
                  P
                  4       V P                   P                  4        V P                   P                  4        R # r   )	rH   rL   ÚstartTLSr   rI   rM   rC   rN   r   )r   rC   r   ÚserverContextÚ	streamings   &€€€€r   ÚconnectionMadeÚ\ProducerTestsMixin.startTLSAfterRegisterProducer.<locals>.RegisterTLSProtocol.connectionMade¡   sØ   ø€ Ø—‘×/Ñ/°¸)ÔDØ—‘×'Ñ'¨Ô6÷ à—M‘M $§.¡.×"9Ñ"9×"CÑ"C×"MÑ"MÔNØ—M‘M $§.¡.×"9Ñ"9×"CÑ"CÕDð —M‘M $§.¡.×"9Ñ"9×"CÑ"C×"MÑ"M×"WÑ"WÔXØ—M‘M $§.¡.×"9Ñ"9×"CÑ"C×"MÑ"MÔNØ—‘×1Ñ1Ô3Ø—‘×-Ñ-Ö/r   r   N©r   r    r!   r"   ra   r#   r$   )r%   rC   r   r_   r`   s   @€€€€r   ÚRegisterTLSProtocolr\       s   ù‡ € ÷0ö 0r   rd   c                   ó.   <a € ] tR t^±t o V3R ltRtV tR# )ÚJProducerTestsMixin.startTLSAfterRegisterProducer.<locals>.StartTLSProtocolc                ó>   <€ V P                   P                  S4       R # r   )rH   r^   )r   ÚclientContexts   &€r   ra   ÚYProducerTestsMixin.startTLSAfterRegisterProducer.<locals>.StartTLSProtocol.connectionMade²   s   ø€ Ø—‘×'Ñ'¨Ö6r   r   Nrc   )r%   rh   s   @€r   ÚStartTLSProtocolrf   ±   s   ù‡ € ÷7ó 7r   rj   N)ÚgetClientContextÚgetServerContextr3   r   r   r   r*   )r   r`   rd   rj   rh   rC   r   r_   s   &f  @@@@r   ÚstartTLSAfterRegisterProducerÚ0ProducerTestsMixin.startTLSAfterRegisterProducer–   s€   ü€ ð
 ×-Ñ-Ó/ˆØ×-Ñ-Ó/ˆØˆÜ“>ˆ÷	0ò 	0Ô"5ô 	0÷"	7Ô2ô 	7ô 	 ØÐ%Ó'Ñ)9Ó);¼Z»\ô	
ð 	×Ñ˜ (¨HÐ!5Ö6r   c                ó(   € V P                  R4       R# )z‡
When a streaming producer is registered, and then startTLS is called,
the producer is re-registered with the C{TLSMemoryBIOProtocol}.
TN©rm   r5   s   &r   Ú+test_startTLSAfterRegisterProducerStreamingÚ>ProducerTestsMixin.test_startTLSAfterRegisterProducerStreamingº   s   € ð
 	×*Ñ*¨4Ö0r   c                ó(   € V P                  R4       R# )z‹
When a non-streaming producer is registered, and then startTLS is
called, the producer is re-registered with the
C{TLSMemoryBIOProtocol}.
FNrp   r5   s   &r   Ú.test_startTLSAfterRegisterProducerNonStreamingÚAProducerTestsMixin.test_startTLSAfterRegisterProducerNonStreamingÁ   s   € ð 	×*Ñ*¨5Ö1r   r   N)r   r    r!   r"   r/   r   r0   rU   rX   rm   rq   rt   r#   r$   r1   s   @r   rR   rR   l   s3   ø‡ € ñ÷ Ø:ˆò3ò"3ò""7òH1÷2ð 2r   rR   )!r/   Útwisted.internetr   Ú&twisted.internet.test.connectionmixinsr   r   Ú#twisted.internet.test.reactormixinsr   Útwisted.internet.test.test_tcpr   Útwisted.internet.test.test_tlsr   r   r	   r
   Útwisted.trialr   r   Ú__newtlsÚtwisted.protocolsr   ÚImportErrorÚzope.interfacer   ÚTestCaser   r3   ÚIHandshakeListenerr@   rR   ÚglobalsÚupdateÚmakeTestCaseClassesr   r   r   Ú<module>r…      sË   ðñõ
 (÷õ ?Ý 5÷ó õ #ðÝ4Ý%ð €GÝ &ô8�X×&Ñ&ô 8÷Bñ ñ ˆZ×*Ñ*Ó+ô(Ð*ó (ó ,ð(ô2[2˜¨Ð3Iô [2ñ| ƒ	× Ñ Ð#×7Ñ7Ó9Ö :øð_ ô Ø‚Gðús   °B6 Â6	CÃC