+
    üÐj�  ã                   óB  € R t ^ RIt^ RIHt ^ RIHtHtHt ^ RIH	t	H
t
HtHtHt ^ RIHtHt ^ RIHt ^ RIHt  ! R R	]P*                  4      t ! R
 R]P.                  4      t ! R R]P*                  4      t ! R R]P4                  4      t ! R R]P8                  4      t ! R R]P<                  4      t ! R R]P@                  4      t! ! R R]PD                  4      t" ! R R]P@                  4      t# ! R R]P@                  4      t$ ! R R]P@                  4      t% ! R R]P*                  ]PL                  4      t' ! R  R!]P@                  4      t( ! R" R#]P@                  4      t) ! R$ R%]4      t* ! R& R']PV                  4      t, ! R( R)]P@                  4      t-R# )*z
Test code for policies.
N)ÚStringIO)Ú	InterfaceÚimplementedByÚimplementer)ÚaddressÚdeferÚprotocolÚreactorÚtask)ÚStringTransportÚ StringTransportWithDisconnection)Úpolicies)Úunittestc                   óD   a € ] tR t^t o ^ ;ttRtR tR tR t	R t
RtV tR# )ÚSimpleProtocoló    c                ón   € \         P                  ! 4       V n        \         P                  ! 4       V n        R # ©N)r   ÚDeferredÚ
dConnectedÚdDisconnected©Úselfs   &Ú</usr/lib/python3/dist-packages/twisted/test/test_policies.pyÚ__init__ÚSimpleProtocol.__init__   s   € ÜŸ.š.Ó*ˆŒÜ"Ÿ^š^Ó-ˆÖr   c                óJ   € ^V n         V P                  P                  R4       R# ©é   Ú N)Ú	connectedr   Úcallbackr   s   &r   ÚconnectionMadeÚSimpleProtocol.connectionMade   s   € ØˆŒØ�‰× Ñ  Ö$r   c                óJ   € ^V n         V P                  P                  R4       R# r   )Údisconnectedr   r!   ©r   Úreasons   &&r   ÚconnectionLostÚSimpleProtocol.connectionLost    s   € ØˆÔØ×Ñ×#Ñ# BÖ'r   c                ó8   € V ;P                   V,          un         R # r   )Úbuffer©r   Údatas   &&r   ÚdataReceivedÚSimpleProtocol.dataReceived$   s   € Ø�Š�tÕ�r   )r    r   r   r%   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r    r%   r+   r   r"   r(   r.   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s-   ø‡ € Ø Ð €I�Ø€Fò.ò%ò(÷ð r   r   c                   ó,   a € ] tR t^(t o R tR tRtV tR# )ÚSillyFactoryc                ó   € Wn         R # r   ©Úp)r   r<   s   &&r   r   ÚSillyFactory.__init__)   s   € ØŽr   c                ó   € V P                   # r   r;   )r   Úaddrs   &&r   ÚbuildProtocolÚSillyFactory.buildProtocol,   s   € Ø�v‰vˆr   r;   N)r0   r1   r2   r3   r   r@   r4   r5   r6   s   @r   r9   r9   (   s   ø‡ € ò÷ð r   r9   c                   ó<   a € ] tR t^0t o RtR tR tR tR tRt	V t
R# )ÚEchoProtocolFc                ó   € R V n         R# ©TN©Úpausedr   s   &r   ÚpauseProducingÚEchoProtocol.pauseProducing3   s	   € ØˆŽr   c                ó   € R V n         R# )FNrF   r   s   &r   ÚresumeProducingÚEchoProtocol.resumeProducing6   s	   € ØˆŽr   c                ó   € R # r   © r   s   &r   ÚstopProducingÚEchoProtocol.stopProducing9   s   € Ùr   c                ó<   € V P                   P                  V4       R # r   )Ú	transportÚwriter,   s   &&r   r.   ÚEchoProtocol.dataReceived<   s   € Ø�‰×Ñ˜TÖ"r   rF   N)r0   r1   r2   r3   rG   rH   rK   rO   r.   r4   r5   r6   s   @r   rC   rC   0   s#   ø‡ € Ø€Fòòò÷#ð #r   rC   c                   ó   € ] tR t^@tRt]tRtR# )ÚServerz0
A simple server factory using L{EchoProtocol}.
rN   N)r0   r1   r2   r3   Ú__doc__rC   r   r4   rN   r   r   rV   rV   @   s   † ñð „Hr   rV   c                   ó0   a € ] tR t^Ht o RtR tR tRtV tR# )ÚTestableThrottlingFactoryz@
L{policies.ThrottlingFactory} using a L{task.Clock} for tests.
c                óZ   € \         P                  P                  ! V .VO5/ VB  Wn        R# ©zx
@param clock: object providing a callLater method that can be used
    for tests.
@type clock: C{task.Clock} or alike.
N)r   ÚThrottlingFactoryr   Úclock©r   r]   ÚargsÚkwargss   &&*,r   r   Ú"TestableThrottlingFactory.__init__M   s'   € ô 	×"Ñ"×+Ò+¨DÐB°4ÒB¸6ÒBØŽ
r   c                ó8   € V P                   P                  W4      # ©z 
Forward to the testable clock.
©r]   Ú	callLater©r   ÚperiodÚfuncs   &&&r   re   Ú#TestableThrottlingFactory.callLaterV   ó   € ð �z‰z×#Ñ# FÓ1Ð1r   ©r]   N©	r0   r1   r2   r3   rW   r   re   r4   r5   r6   s   @r   rY   rY   H   ó   ø‡ € ñò÷2ð 2r   rY   c                   ó0   a € ] tR t^]t o RtR tR tRtV tR# )ÚTestableTimeoutFactoryz=
L{policies.TimeoutFactory} using a L{task.Clock} for tests.
c                óZ   € \         P                  P                  ! V .VO5/ VB  Wn        R# r[   )r   ÚTimeoutFactoryr   r]   r^   s   &&*,r   r   ÚTestableTimeoutFactory.__init__b   s'   € ô 	×Ñ×(Ò(¨Ð?°Ò?¸Ò?ØŽ
r   c                ó8   € V P                   P                  W4      # rc   rd   rf   s   &&&r   re   Ú TestableTimeoutFactory.callLaterk   rj   r   rk   Nrl   r6   s   @r   ro   ro   ]   rm   r   ro   c                   ó„   a € ] tR t^rt 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RtV tR# )ÚWrapperTestsz6
Tests for L{WrappingFactory} and L{ProtocolWrapper}.
c                óà   € \        4       p\        P                  ! V4      pVP                  \        P
                  ! RR^#4      4      pV P                  VP                  P                  V4       R# )zN
Make sure protocol.factory is the wrapped factory, not the wrapping
factory.
ÚTCPú	127.0.0.1N)	rV   r   ÚWrappingFactoryr@   r   ÚIPv4AddressÚassertIsÚwrappedProtocolÚfactory)r   ÚfÚwfr<   s   &   r   Útest_protocolFactoryAttributeÚ*WrapperTests.test_protocolFactoryAttributew   sT   € ô
 ‹HˆÜ×%Ò% aÓ(ˆØ×ÑœW×0Ò0°¸ÀRÓHÓIˆØ�‰�a×'Ñ'×/Ñ/°Ö3r   c                ó†  €  ! R R\         4      p\        V4       ! R R4      4       p\        \        P                  4       \
        P                  ! 4       p\        P                  ! \        P                  ! R4      V4      pVP                  V! 4       4       V P                  VP                  VP                  4      4       R# )z’
The transport wrapper passed to the wrapped protocol's
C{makeConnection} provides the same interfaces as are provided by the
original transport.
c                   ó   € ] tR t^ˆtRtR# )Ú=WrapperTests.test_transportInterfaces.<locals>.IStubTransportrN   N©r0   r1   r2   r3   r4   rN   r   r   ÚIStubTransportr…   ˆ   ó   † Ûr   r‡   c                   ó   € ] tR t^‹tRtR# )Ú<WrapperTests.test_transportInterfaces.<locals>.StubTransportrN   Nr†   rN   r   r   ÚStubTransportrŠ   ‹   s   † ãr   r‹   N)r   r   r   r   ÚProtocolWrapperr   ÚProtocolrz   ÚmakeConnectionÚ
assertTrueÚ
providedByrR   )r   r‡   r‹   ÚprotoÚwrappers   &    r   Útest_transportInterfacesÚ%WrapperTests.test_transportInterfaces�   s’   € ô	œYô 	ô 
�^Ó	$÷	ð 	ó 
%ð	ô 	”h×.Ñ.Ô/ä×!Ò!Ó#ˆÜ×*Ò*¬8×+CÒ+CÀDÓ+IÈ5ÓQˆà×Ñ™}›Ô/Ø�‰˜×1Ñ1°%·/±/ÓBÖCr   c                ó†   € \        4       p\        P                  ! V4      pV P                  RVP	                  4       4       R# )zk
L{WrappingFactory.logPrefix} is customized to mention both the original
factory and the wrapping factory.
zServer (WrappingFactory)N)rV   r   rz   ÚassertEqualÚ	logPrefix)r   Úserverr~   s   &  r   Útest_factoryLogPrefixÚ"WrapperTests.test_factoryLogPrefixž   s5   € ô
 “ˆÜ×*Ò*¨6Ó2ˆØ×ÑÐ3°W×5FÑ5FÓ5HÖIr   c                ó”   €  ! R R4      pV! 4       p\         P                  ! V4      pV P                  RVP                  4       4       R# )z
If the wrapped factory doesn't have a L{logPrefix} method,
L{WrappingFactory.logPrefix} falls back to the factory class name.
c                   ó   € ] tR t^­tRtR# )Ú=WrapperTests.test_factoryLogPrefixFallback.<locals>.NoFactoryrN   Nr†   rN   r   r   Ú	NoFactoryr�   ­   rˆ   r   rž   zNoFactory (WrappingFactory)N)r   rz   r–   r—   )r   rž   r˜   r~   s   &   r   Útest_factoryLogPrefixFallbackÚ*WrapperTests.test_factoryLogPrefixFallback§   s?   € ÷	ñ 	ñ “ˆÜ×*Ò*¨6Ó2ˆØ×ÑÐ6¸×8IÑ8IÓ8KÖLr   c                óÖ   € \        4       p\        P                  ! V4      pVP                  \        P
                  ! RR^#4      4      pV P                  RVP                  ! 4       4       R# )zc
L{ProtocolWrapper.logPrefix} is customized to mention both the original
protocol and the wrapper.
rx   ry   zEchoProtocol (ProtocolWrapper)N)rV   r   rz   r@   r   r{   r–   r—   )r   r˜   r~   r   s   &   r   Útest_protocolLogPrefixÚ#WrapperTests.test_protocolLogPrefix´   sU   € ô
 “ˆÜ×*Ò*¨6Ó2ˆØ×(Ñ(¬×)<Ò)<¸UÀKÐQSÓ)TÓUˆØ×ÑÐ9¸8×;MÒ;MÓ;OÖPr   c                óö   €  ! R R4      p\        4       pWn        \        P                  ! V4      pVP	                  \
        P                  ! RR^#4      4      pV P                  RVP                  ! 4       4       R# )z�
If the wrapped protocol doesn't have a L{logPrefix} method,
L{ProtocolWrapper.logPrefix} falls back to the protocol class name.
c                   ó   € ] tR t^ÄtRtR# )Ú?WrapperTests.test_protocolLogPrefixFallback.<locals>.NoProtocolrN   Nr†   rN   r   r   Ú
NoProtocolr¦   Ä   rˆ   r   r§   rx   ry   zNoProtocol (ProtocolWrapper)N)	rV   r   r   rz   r@   r   r{   r–   r—   )r   r§   r˜   r~   r   s   &    r   Útest_protocolLogPrefixFallbackÚ+WrapperTests.test_protocolLogPrefixFallback¾   sd   € ÷	ñ 	ô “ˆØ$ŒÜ×*Ò*¨6Ó2ˆØ×(Ñ(¬×)<Ò)<¸UÀKÐQSÓ)TÓUˆØ×ÑÐ7¸×9KÒ9KÓ9MÖNr   c                óÈ   € \         P                  ! \         P                  ! \        4       4      \        P
                  ! 4       4      p\        4       pVP                  V4       V# )zU
Return L{policies.ProtocolWrapper} that has been connected to a
L{StringTransport}.
)r   rŒ   rz   rV   r   r�   r   rŽ   ©r   r’   rR   s   &  r   Ú_getWrapperÚWrapperTests._getWrapperÍ   sL   € ô
 ×*Ò*Ü×$Ò$¤V£XÓ.´×0AÒ0AÓ0Có
ˆô $Ó%ˆ	Ø×Ñ˜yÔ)Øˆr   c                ó–   € V P                  4       pV P                  VP                  4       VP                  P                  4       4       R# )zS
L{policies.ProtocolWrapper.getHost} calls C{getHost} on the underlying
transport.
N)r¬   r–   ÚgetHostrR   ©r   r’   s   & r   Útest_getHostÚWrapperTests.test_getHostÙ   ó8   € ð
 ×"Ñ"Ó$ˆØ×Ñ˜Ÿ™Ó*¨G×,=Ñ,=×,EÑ,EÓ,GÖHr   c                ó–   € V P                  4       pV P                  VP                  4       VP                  P                  4       4       R# )zS
L{policies.ProtocolWrapper.getPeer} calls C{getPeer} on the underlying
transport.
N)r¬   r–   ÚgetPeerrR   r°   s   & r   Útest_getPeerÚWrapperTests.test_getPeerá   r³   r   c                óô   € V P                  4       p\        4       pVP                  VR4       V P                  VP                  P
                  V4       V P                  VP                  P                  4       R# )ze
L{policies.ProtocolWrapper.registerProducer} calls C{registerProducer}
on the underlying transport.
TN)r¬   ÚobjectÚregisterProducerr|   rR   Úproducerr�   Ú	streaming©r   r’   r»   s   &  r   Útest_registerProducerÚ"WrapperTests.test_registerProduceré   s[   € ð
 ×"Ñ"Ó$ˆÜ“8ˆØ× Ñ  ¨4Ô0Ø�‰�g×'Ñ'×0Ñ0°(Ô;Ø�‰˜×)Ñ)×3Ñ3Ö4r   c                ó  € V P                  4       p\        4       pVP                  VR4       VP                  4        V P	                  VP
                  P                  4       V P	                  VP
                  P                  4       R# )zi
L{policies.ProtocolWrapper.unregisterProducer} calls
C{unregisterProducer} on the underlying transport.
TN)r¬   r¹   rº   ÚunregisterProducerÚassertIsNonerR   r»   r¼   r½   s   &  r   Útest_unregisterProducerÚ$WrapperTests.test_unregisterProducerô   si   € ð
 ×"Ñ"Ó$ˆÜ“8ˆØ× Ñ  ¨4Ô0Ø×"Ñ"Ô$Ø×Ñ˜'×+Ñ+×4Ñ4Ô5Ø×Ñ˜'×+Ñ+×5Ñ5Ö6r   c                óœ   a€ V P                  4       p. oV3R lVP                  n        VP                  4        V P                  SR.4       R# )z_
L{policies.ProtocolWrapper.stopConsuming} calls C{stopConsuming} on
the underlying transport.
c                  ó&   <€ S P                  R 4      # )T©Úappend)Úresults   €r   Ú<lambda>Ú1WrapperTests.test_stopConsuming.<locals>.<lambda>  s   ø€ °&·-±-ÀÔ2Er   TN)r¬   rR   ÚstopConsumingr–   )r   r’   rÉ   s   & @r   Útest_stopConsumingÚWrapperTests.test_stopConsuming   sD   ø€ ð
 ×"Ñ"Ó$ˆØˆÜ*Eˆ×ÑÔ'Ø×ÑÔØ×Ñ˜ $ Ö(r   c                ó¸   a€ . o ! V3R lR4      p\         P                  ! V! 4       4      p\        4       pVP                  V4       V P	                  SV.4       R# )ze
L{policies.WrappingFactory.startedConnecting} calls
C{startedConnecting} on the underlying factory.
c                   ó.   <a € ] tR tRt o V3R ltRtV tR# )Ú4WrapperTests.test_startedConnecting.<locals>.Factoryi  c                ó*   <€ SP                  V4       R # r   rÇ   )r   Ú	connectorrÉ   s   &&€r   ÚstartedConnectingÚFWrapperTests.test_startedConnecting.<locals>.Factory.startedConnecting  s   ø€ Ø—‘˜iÖ(r   rN   N)r0   r1   r2   r3   rÔ   r4   r5   ©r7   rÉ   s   @€r   ÚFactoryrÑ     s   ù‡ € ÷)ó )r   r×   N)r   rz   r¹   rÔ   r–   )r   r×   r’   rÓ   rÉ   s   &   @r   Útest_startedConnectingÚ#WrapperTests.test_startedConnecting  sO   ø€ ð
 ˆ÷	)ô 	)ô ×*Ò*©7«9Ó5ˆÜ“Hˆ	Ø×!Ñ! )Ô,Ø×Ñ˜ ) Ö-r   c                óÎ   a€ . o ! V3R lR4      p\         P                  ! V! 4       4      p\        4       p\        4       pVP                  W44       V P	                  SW43.4       R# )zk
L{policies.WrappingFactory.clientConnectionLost} calls
C{clientConnectionLost} on the underlying factory.
c                   ó.   <a € ] tR tRt o V3R ltRtV tR# )Ú7WrapperTests.test_clientConnectionLost.<locals>.Factoryi"  c                ó,   <€ SP                  W34       R # r   rÇ   ©r   rÓ   r'   rÉ   s   &&&€r   ÚclientConnectionLostÚLWrapperTests.test_clientConnectionLost.<locals>.Factory.clientConnectionLost#  ó   ø€ Ø—‘˜yÐ1Ö2r   rN   N)r0   r1   r2   r3   rß   r4   r5   rÖ   s   @€r   r×   rÜ   "  ó   ù‡ € ÷3ó 3r   r×   N)r   rz   r¹   rß   r–   ©r   r×   r’   rÓ   r'   rÉ   s   &    @r   Útest_clientConnectionLostÚ&WrapperTests.test_clientConnectionLost  sZ   ø€ ð
 ˆ÷	3ô 	3ô ×*Ò*©7«9Ó5ˆÜ“Hˆ	Ü“ˆØ×$Ñ$ YÔ7Ø×Ñ˜ 9Ð"5Ð!6Ö7r   c                óÎ   a€ . o ! V3R lR4      p\         P                  ! V! 4       4      p\        4       p\        4       pVP                  W44       V P	                  SW43.4       R# )zo
L{policies.WrappingFactory.clientConnectionFailed} calls
C{clientConnectionFailed} on the underlying factory.
c                   ó.   <a € ] tR tRt o V3R ltRtV tR# )Ú9WrapperTests.test_clientConnectionFailed.<locals>.Factoryi3  c                ó,   <€ SP                  W34       R # r   rÇ   rÞ   s   &&&€r   ÚclientConnectionFailedÚPWrapperTests.test_clientConnectionFailed.<locals>.Factory.clientConnectionFailed4  rá   r   rN   N)r0   r1   r2   r3   rê   r4   r5   rÖ   s   @€r   r×   rè   3  râ   r   r×   N)r   rz   r¹   rê   r–   rã   s   &    @r   Útest_clientConnectionFailedÚ(WrapperTests.test_clientConnectionFailed,  sZ   ø€ ð
 ˆ÷	3ô 	3ô ×*Ò*©7«9Ó5ˆÜ“Hˆ	Ü“ˆØ×&Ñ& yÔ9Ø×Ñ˜ 9Ð"5Ð!6Ö7r   c                ó`  € \         P                  ! \         P                  ! \        4       4      \        P
                  ! 4       4      p\        4       pWn        VP                  V4       V P                  VP                  4       VP                  4        V P                  VP                  4       R# )z˜
L{policies.ProtocolWrapper.connectionLost} sets C{wrappedProtocol} to
C{None} in order to break reference cycle between wrapper and wrapped
protocols.
N)r   rŒ   rz   rV   r   r�   r   rŽ   ÚassertIsNotNoner}   ÚloseConnectionrÂ   r«   s   &  r   Útest_breakReferenceCycleÚ%WrapperTests.test_breakReferenceCycle=  s�   € ô ×*Ò*Ü×$Ò$¤V£XÓ.´×0AÒ0AÓ0Có
ˆô 5Ó6ˆ	Ø$ÔØ×Ñ˜yÔ)à×Ñ˜W×4Ñ4Ô5Ø× Ñ Ô"Ø×Ñ˜'×1Ñ1Ö2r   rN   N)r0   r1   r2   r3   rW   r�   r“   r™   rŸ   r¢   r¨   r¬   r±   r¶   r¾   rÃ   rÍ   rØ   rä   rì   rñ   r4   r5   r6   s   @r   rv   rv   r   sf   ø‡ € ñò4òDò:JòMòQòOò
òIòIò	5ò
7ò	)ò.ò 8ò"8÷"3ð 3r   rv   c                   ó,   a € ] tR tRt o R tR tRtV tR# )rz   iO  c                ó   € V# r   rN   )r   r   r<   s   &&&r   r   ÚWrappingFactory.protocolP  s   € Øˆr   c                óz   € \         P                  P                  V 4       V P                  P	                  R 4       R # r   )r   rz   ÚstartFactoryÚdeferredr!   r   s   &r   r÷   ÚWrappingFactory.startFactoryS  s(   € Ü× Ñ ×-Ñ-¨dÔ3Ø�‰×Ñ˜tÖ$r   rN   N)r0   r1   r2   r3   r   r÷   r4   r5   r6   s   @r   rz   rz   O  s   ø‡ € ò÷%ð %r   rz   c                   ó<   a € ] tR tRt o RtR tR tR tR tRt	V t
R# )	ÚThrottlingTestsiX  z*
Tests for L{policies.ThrottlingFactory}.
c                óì  a a	a
aaaaa€ \        4       pR \        ^4       4       w  o	o
oo\        P                  ! V^4      o\	        S4      p\
        P                  ! 4       Vn        \        P                  ! ^ VRR7      oSP                  4       P                  oV	V
VV3R lpV	V
VV V3R lpV	3R lpVV3R lpVV 3R lpV
VV3R	 lpVP                  P                  V4       VP                  P                  V4       VP                  P                  V4       VP                  P                  V4       VP                  P                  V4       VP                  P                  V4       VP                  # )
z‹
Full test using a custom server limiting number of connections.

FIXME: https://twistedmatrix.com/trac/ticket/10012
This is a flaky test.
c              3   ó6   "  € T F  p\        4       x € K  	  R # 5ir   )r   )Ú.0Úis   & r   Ú	<genexpr>Ú-ThrottlingTests.test_limit.<locals>.<genexpr>e  s   é € Ð=±H¨qœ.×*Ð*³Hùs   ‚ry   )Ú	interfacec                 óÞ   <€ \         P                  ! R S\        S4      4       SP                  P	                  VV3R l4       SP                  P	                  VV3R l4       SP
                  # )ry   c                 óF   <€ \         P                  ! R S\        S4      4      # ©ry   ©r	   Ú
connectTCPr9   )ÚrÚc2Úns   &€€r   rÊ   ÚAThrottlingTests.test_limit.<locals>._connect123.<locals>.<lambda>q  ó   ø€ œ'×,Ò,¨[¸!¼\È"Ó=MÔNr   c                 óF   <€ \         P                  ! R S\        S4      4      # r  r  )r  Úc3r
  s   &€€r   rÊ   r  t  r  r   )r	   r  r9   r   ÚaddCallbackr   )ÚresultsÚc1r	  r  r
  s   &€€€€r   Ú_connect123Ú/ThrottlingTests.test_limit.<locals>._connect123n  sT   ø€ Ü×Ò˜{¨A¬|¸BÓ/?Ô@Ø�M‰M×%Ñ%ÝNôð �M‰M×%Ñ%ÝNôð ×#Ñ#Ð#r   c                 óB  <€ SP                  SSS3 Uu. uF  qP                  NK  	  up. RO4       SP                  SSS3 Uu. uF  qP                  NK  	  up. RO4       SP                  \        SP                  P                  4       4      ^4       V # u upi u upi )r   )r   r   r   )é    r  r   )r–   r    r%   ÚlenÚ	protocolsÚkeys)r  Úcr  r	  r  r   ÚtServers   & €€€€€r   Ú	_check123Ú-ThrottlingTests.test_limit.<locals>._check123x  sƒ   ø€ Ø×Ñ°B¸¸B±<Ó@±<¨aŸkœk±<Ñ@Â)ÔLØ×Ñ°r¸2¸r±lÓC±l°Ÿnœn±lÑCÂYÔOØ×ÑœS ×!2Ñ!2×!7Ñ!7Ó!9Ó:¸AÔ>ØˆNùò AùÚCs   ”BÁBc                 óP   <€ SP                   P                  4        SP                  # r   )rR   rð   r   )r  r  s   &€r   Ú_lose1Ú*ThrottlingTests.test_limit.<locals>._lose1~  s   ø€ à�L‰L×'Ñ'Ô)Ø×#Ñ#Ð#r   c                 ó^   <€ \         P                  ! R S\        S4      4       SP                  # r  )r	   r  r9   r   )r  Úc4r
  s   &€€r   Ú	_connect4Ú-ThrottlingTests.test_limit.<locals>._connect4ƒ  s$   ø€ Ü×Ò˜{¨A¬|¸BÓ/?Ô@Ø—=‘=Ð r   c                 óx   <€ SP                  SP                  ^4       SP                  SP                  ^ 4       V # )r   )r–   r    r%   )r  r!  r   s   &€€r   Ú_check4Ú+ThrottlingTests.test_limit.<locals>._check4‡  s0   ø€ Ø×Ñ˜RŸ\™\¨1Ô-Ø×Ñ˜RŸ_™_¨aÔ0ØˆNr   c                 óä   <€ SS3 F  pVP                   P                  4        K  	  \        P                  ! \        P                  ! SP
                  4      SP                  SP                  .4      # r   )rR   rð   r   ÚDeferredListÚmaybeDeferredÚstopListeningr   )r  r  r	  r!  r<   s   & €€€r   Ú_cleanupÚ,ThrottlingTests.test_limit.<locals>._cleanupŒ  s]   ø€ Ø˜“V�Ø—‘×*Ñ*Ö,ñ ä×%Ò%ä×'Ò'¨¯©Ó8Ø×$Ñ$Ø×$Ñ$ðóð r   )rV   Úranger   r\   rz   r   r   rø   r	   Ú	listenTCPr¯   Úportr  )r   r˜   ÚwrapTServerr  r  r  r"  r%  r+  r  r	  r  r!  r
  r<   r  s   f        @@@@@@@r   Ú
test_limitÚThrottlingTests.test_limit]  s"  ÿ€ ô “ˆÙ=´E¸!´HÓ=‰ˆˆB��BÜ×,Ò,¨V°QÓ7ˆÜ% gÓ.ˆÜ$Ÿ~š~Ó/ˆÔô ×Ò˜a ¸ÔDˆØ�I‰I‹K×Ñˆ÷	$ð 	$÷	ñ 	õ	$ö
	!ö	÷
		ð 	×Ñ×(Ñ(¨Ô5Ø×Ñ×(Ñ(¨Ô3Ø×Ñ×(Ñ(¨Ô0Ø×Ñ×(Ñ(¨Ô3Ø×Ñ×(Ñ(¨Ô1Ø×Ñ×(Ñ(¨Ô2Ø×#Ñ#Ð#r   c                ó–  € \        4       p\        \        P                  ! 4       V4      pVP	                  \
        P                  ! RR^ 4      4      p\        4       pW4n        VP                  ! V4       VP                  ! R.^,          4       V P                  VP                  4       R4       V P                  VP                  ^4       R# )zJ
L{ThrottlingProtocol.writeSequence} is called on the underlying factory.
rx   ry   ó   bytess   bytesbytesbytesbytesN)rV   rY   r
   ÚClockr@   r   r{   r   r   rŽ   ÚwriteSequencer–   ÚvalueÚwrittenThisSecond)r   r˜   r  r   rR   s   &    r   Útest_writeSequenceÚ"ThrottlingTests.test_writeSequenceŸ  s›   € ô “ˆÜ+¬D¯JªJ«L¸&ÓAˆØ×(Ñ(¬×)<Ò)<¸UÀKÐQRÓ)SÓTˆÜ4Ó6ˆ	Ø%ÔØ×Ò 	Ô*à×Ò ˜z¨A�~Ô.Ø×Ñ˜Ÿ™Ó*Ð,CÔDØ×Ñ˜×2Ñ2°BÖ7r   c                ó„  € \        4       p\        \        P                  ! 4       V^
R7      pVP	                  \
        P                  ! RR^ 4      4      p\        4       pW4n        VP                  V4       VP                  Vn        VP                  R4       VP                  R4       V P                  VP                  4       R4       V P                  VP                  ^4       V P!                  VP                  P"                  4       VP$                  P'                  R4       V P                  VP                  ^ 4       V P)                  VP                  P"                  4       VP$                  P'                  R4       V P                  VP                  ^ 4       V P!                  VP                  P"                  4       R# )	zM
Check the writeLimit parameter: write data, and check for the pause
status.
)Ú
writeLimitrx   ry   ó
   0123456789ó
   abcdefghijó   0123456789abcdefghijçÍÌÌÌÌÌð?N)rV   rY   r
   r5  r@   r   r{   r   r   rŽ   r}   r»   r.   r–   r7  r8  ÚassertFalserG   r]   Úadvancer�   ©r   r˜   r  r/  Útrs   &    r   Útest_writeLimitÚThrottlingTests.test_writeLimit®  sM  € ô
 “ˆÜ+¬D¯JªJ«L¸&ÈRÔPˆØ×$Ñ$¤W×%8Ò%8¸ÀÈQÓ%OÓPˆÜ-Ó/ˆØŒØ×Ñ˜BÔØ×,Ñ,ˆŒà×Ñ˜-Ô(Ø×Ñ˜-Ô(Ø×Ñ˜Ÿ™›Ð%<Ô=Ø×Ñ˜×2Ñ2°BÔ7Ø×Ñ˜×-Ñ-×4Ñ4Ô5ð
 	�‰×Ñ˜dÔ#Ø×Ñ˜×2Ñ2°AÔ6Ø�‰˜×,Ñ,×3Ñ3Ô4à�‰×Ñ˜dÔ#Ø×Ñ˜×2Ñ2°AÔ6Ø×Ñ˜×-Ñ-×4Ñ4Ö5r   c                ó  € \        4       p\        \        P                  ! 4       V^
R7      pVP	                  \
        P                  ! RR^ 4      4      p\        4       pW4n        VP                  V4       VP                  R4       VP                  R4       V P                  VP                  4       R4       V P                  VP                  ^4       VP                  P                  R4       V P                  VP                  ^ 4       V P                  VP                   R4       VP                  P                  R4       V P                  VP                  ^ 4       V P                  VP                   R	4       VP#                  4        VP                  R4       VP                  R4       V P                  VP                  4       R4       V P                  VP                  ^4       VP                  P                  R4       V P                  VP                  ^ 4       V P                  VP                   R4       VP                  P                  R4       V P                  VP                  ^ 4       V P                  VP                   R	4       R
# )zJ
Check the readLimit parameter: read data and check for the pause
status.
)Ú	readLimitrx   ry   r=  r>  r?  r@  rG   Ú	producingN)rV   rY   r
   r5  r@   r   r{   r   r   rŽ   r.   r–   r7  ÚreadThisSecondr]   rB  ÚproducerStateÚclearrC  s   &    r   Útest_readLimitÚThrottlingTests.test_readLimitÌ  sì  € ô
 “ˆÜ+¬D¯JªJ«L¸&ÈBÔOˆØ×$Ñ$¤W×%8Ò%8¸ÀÈQÓ%OÓPˆÜ-Ó/ˆØŒØ×Ñ˜BÔà×Ñ˜-Ô(Ø×Ñ˜-Ô(Ø×Ñ˜Ÿ™›Ð%<Ô=Ø×Ñ˜×/Ñ/°Ô4à�‰×Ñ˜dÔ#Ø×Ñ˜×/Ñ/°Ô3Ø×Ñ˜×)Ñ)¨8Ô4à�‰×Ñ˜dÔ#Ø×Ñ˜×/Ñ/°Ô3Ø×Ñ˜×)Ñ)¨;Ô7à
�‰Œ
Ø×Ñ˜-Ô(Ø×Ñ˜-Ô(Ø×Ñ˜Ÿ™›Ð%<Ô=Ø×Ñ˜×/Ñ/°Ô4à�‰×Ñ˜dÔ#Ø×Ñ˜×/Ñ/°Ô3Ø×Ñ˜×)Ñ)¨8Ô4à�‰×Ñ˜dÔ#Ø×Ñ˜×/Ñ/°Ô3Ø×Ñ˜×)Ñ)¨;Ö7r   rN   N)r0   r1   r2   r3   rW   r1  r9  rE  rM  r4   r5   r6   s   @r   rû   rû   X  s%   ø‡ € ñò@$òD8ò6÷<%8ð %8r   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	# )
ÚTimeoutProtocolTestsiô  z(
Tests for L{policies.TimeoutProtocol}.
c                ó  € \         P                  ! 4       p\        P                  ! 4       p\        Vn        \        WR4      pVP                  \        P                  ! RRR4      4      p\        4       pWEn        VP                  V4       WA3# )z®
Helper to set up an already connected protocol to be tested.

@return: A new protocol with its attached clock.
@rtype: Tuple of (L{policies.TimeoutProtocol}, L{task.Clock})
Nrx   ry   é90  )r
   r5  r   ÚServerFactoryr   ro   r@   r   r{   r   rŽ   )r   r]   ÚwrappedFactoryr~   r‘   rR   s   &     r   ÚgetProtocolAndClockÚ(TimeoutProtocolTests.getProtocolAndClockù  st   € ô —
’
“ˆä!×/Ò/Ó1ˆÜ"0ˆÔä(¨ÀÓEˆà×%Ñ%¤g×&9Ò&9¸%ÀÈeÓ&TÓUˆä4Ó6ˆ	Ø"ÔØ×Ñ˜YÔ'àˆ~Ðr   c                ó°  € V P                  4       w  rVP                  ^4       V P                  VP                  4       V P	                  VP
                  P                  4       VP                  ^4       VP                  4        V P                  VP                  4       VP                  ^4       V P	                  VP
                  P                  4       R# )z"
Will cancel the ongoing timeout.
N)
rU  Ú
setTimeoutrï   ÚtimeoutCallrA  r}   r%   rB  ÚcancelTimeoutrÂ   ©r   Úsutr]   s   &  r   Útest_cancelTimeoutÚ'TimeoutProtocolTests.test_cancelTimeout  sž   € ð ×-Ñ-Ó/‰
ˆØ�‰�qÔà×Ñ˜SŸ_™_Ô-Ø×Ñ˜×,Ñ,×9Ñ9Ô:à�‰�aÔØ×ÑÔà×Ñ˜#Ÿ/™/Ô*ð 	�‰�aÔØ×Ñ˜×,Ñ,×9Ñ9Ö:r   c                óÊ   € V P                  4       w  rV P                  VP                  4       VP                  4        V P	                  VP
                  P                  4       R# )z,
Does nothing if no timeout is already set.
N)rU  rÂ   rY  rZ  rA  r}   r%   r[  s   &  r   Útest_cancelTimeoutNoTimeoutÚ0TimeoutProtocolTests.test_cancelTimeoutNoTimeout"  sN   € ð ×-Ñ-Ó/‰
ˆØ×Ñ˜#Ÿ/™/Ô*à×ÑÔð 	×Ñ˜×,Ñ,×9Ñ9Ö:r   c                óÜ   € V P                  4       w  rVP                  pVP                  ^4       VP                  ^4       V P	                  VP
                  4       VP                  4        R# )z0
Does nothing if no timeout is already reached.
N)rU  r}   rX  rB  r�   r%   rZ  )r   r\  r]   ÚwrappedProtos   &   r   Útest_cancelTimeoutAlreadyCalledÚ4TimeoutProtocolTests.test_cancelTimeoutAlreadyCalled.  sW   € ð ×-Ñ-Ó/‰
ˆØ×*Ñ*ˆØ�‰�qÔà�‰�aÔØ�‰˜×1Ñ1Ô2ð 	×ÑÖr   c                óê   € V P                  4       w  rVP                  ^4       VP                  P                  4        VP	                  4        V P                  VP                  P                  4       R# )zU
Does nothing if the timeout is cancelled from another part.
Ex from another thread.
N)rU  rX  rY  ÚcancelrZ  rA  r}   r%   r[  s   &  r   Ú"test_cancelTimeoutAlreadyCancelledÚ7TimeoutProtocolTests.test_cancelTimeoutAlreadyCancelled<  sX   € ð
 ×-Ñ-Ó/‰
ˆØ�‰�qÔà�‰×ÑÔ ð 	×ÑÔà×Ñ˜×,Ñ,×9Ñ9Ö:r   rN   N)r0   r1   r2   r3   rW   rU  r]  r`  rd  rh  r4   r5   r6   s   @r   rP  rP  ô  s(   ø‡ € ñòò,;ò&
;ò÷;ð ;r   rP  c                   ó<   a € ] tR tRt o RtR tR tR tR tRt	V t
R# )	ÚTimeoutFactoryTestsiL  z'
Tests for L{policies.TimeoutFactory}.
c                óò  € \         P                  ! 4       V n        \        P                  ! 4       p\
        Vn        \        V P                  V^4      V n        V P                  P                  \        P                  ! RRR4      4      V n        \        4       V n        V P                  V P                  n        V P                  P                  V P                  4       V P                  P                  V n        R# )zY
Create a testable, deterministic clock, and a set of
server factory/protocol/transport.
rx   ry   rR  N)r
   r5  r]   r   rS  r   ro   r~   r@   r   r{   r‘   r   rR   rŽ   r}   rc  )r   rT  s   & r   ÚsetUpÚTimeoutFactoryTests.setUpQ  s§   € ô
 —Z’Z“\ˆŒ
Ü!×/Ò/Ó1ˆÜ"0ˆÔÜ-¨d¯j©j¸.È!ÓLˆŒØ—\‘\×/Ñ/Ü×Ò  {°EÓ:ó
ˆŒ
ô :Ó;ˆŒØ"&§*¡*ˆ�‰ÔØ�
‰
×!Ñ! $§.¡.Ô1Ø ŸJ™J×6Ñ6ˆÖr   c                ó  € V P                   P                  . RO4       V P                  V P                  P                  4       V P                   P                  RR.4       V P                  V P                  P                  4       R# )z–
Make sure that when a TimeoutFactory accepts a connection, it will
time out that connection if no data is read or written within the
timeout period.
ç        çš™™™™™É?N)rp  ç      à?ç      ð?rs  gš™™™™™Ù?)r]   ÚpumprA  rc  r%   r�   r   s   &r   Útest_timeoutÚ TimeoutFactoryTests.test_timeoutb  s]   € ð 	�
‰
�‰Ò1Ô2Ø×Ñ˜×*Ñ*×7Ñ7Ô8ð 	�
‰
�‰˜˜c˜
Ô#Ø�‰˜×)Ñ)×6Ñ6Ö7r   c                ó’  € V P                   P                  . RO4       V P                  V P                  P                  4       V P
                  P                  R4       V P                   P                  . RO4       V P                  V P                  P                  4       V P
                  P                  R.^,          4       V P                   P                  . RO4       V P                  V P                  P                  4       V P                   P                  RR.4       V P                  V P                  P                  4       R# )zz
Make sure that writing data to a transport from a protocol
constructed by a TimeoutFactory resets the timeout countdown.
rp  ó   bytes bytes bytesr4  g       @N)rp  rr  rs  ©rp  rs  rs  )	r]   rt  rA  rc  r%   r‘   rS   r6  r�   r   s   &r   Útest_sendAvoidsTimeoutÚ*TimeoutFactoryTests.test_sendAvoidsTimeoutp  sã   € ð 	�
‰
�‰šÔ(Ø×Ñ˜×*Ñ*×7Ñ7Ô8ð 	�
‰
×ÑÐ-Ô.ð 	�
‰
�‰šÔ(Ø×Ñ˜×*Ñ*×7Ñ7Ô8ð 	�
‰
× Ñ  ( ¨a¥Ô0ð 	�
‰
�‰šÔ(Ø×Ñ˜×*Ñ*×7Ñ7Ô8ð 	�
‰
�‰˜˜c˜
Ô#Ø�‰˜×)Ñ)×6Ñ6Ö7r   c                óÈ  € V P                   P                  . RO4       V P                  V P                  P                  4       V P
                  P                  R4       V P                   P                  . RO4       V P                  V P                  P                  4       V P                   P                  . RO4       V P                  V P                  P                  4       R# )zB
Make sure that receiving data also resets the timeout countdown.
rx  N)rp  rs  rr  ry  )r]   rt  rA  rc  r%   r‘   r.   r�   r   s   &r   Útest_receiveAvoidsTimeoutÚ-TimeoutFactoryTests.test_receiveAvoidsTimeoutŒ  s™   € ð
 	�
‰
�‰šÔ(Ø×Ñ˜×*Ñ*×7Ñ7Ô8ð 	�
‰
×ÑÐ 4Ô5ð 	�
‰
�‰šÔ(Ø×Ñ˜×*Ñ*×7Ñ7Ô8ð 	�
‰
�‰šÔ(Ø�‰˜×)Ñ)×6Ñ6Ö7r   )r]   r~   r‘   rR   rc  N)r0   r1   r2   r3   rW   rm  ru  rz  r}  r4   r5   r6   s   @r   rk  rk  L  s#   ø‡ € ñò7ò"8ò8÷88ð 8r   rk  c                   óT   a € ] tR tRt o Rt^tRtR tR tR t	RR lt
R	 tR
 tRtV tR# )ÚTimeoutTesteri¡  z„
A testable protocol with timeout facility.

@ivar timedOut: set to C{True} if a timeout has been detected.
@type timedOut: C{bool}
Fc                ó   € Wn         R# )z6
Initialize the protocol with a C{task.Clock} object.
Nrk   )r   r]   s   &&r   r   ÚTimeoutTester.__init__¬  s	   € ð Ž
r   c                ó<   € V P                  V P                  4       R# )z#
Upon connection, set the timeout.
N)rX  ÚtimeOutr   s   &r   r"   ÚTimeoutTester.connectionMade²  s   € ð 	�‰˜Ÿ™Ö%r   c                ód   € V P                  4        \        P                  P                  W4       R# )z
Reset the timeout on data.
N)ÚresetTimeoutr   r�   r.   r,   s   &&r   r.   ÚTimeoutTester.dataReceived¸  s$   € ð 	×ÑÔÜ×Ñ×&Ñ& tÖ2r   Nc                ó(   € V P                  R4       R# )z4
On connection lost, cancel all timeout operations.
N)rX  r&   s   &&r   r(   ÚTimeoutTester.connectionLost¿  s   € ð 	�‰˜Ör   c                ó   € RV n         R# )zH
Flags the timedOut variable to indicate the timeout of the connection.
TN)ÚtimedOutr   s   &r   ÚtimeoutConnectionÚTimeoutTester.timeoutConnectionÅ  s   € ð ˆŽr   c                óB   € V P                   P                  ! W.VO5/ VB # )z4
Override callLater to use the deterministic clock.
rd   )r   Útimeoutrh   r_   r`   s   &&&*,r   re   ÚTimeoutTester.callLaterË  s#   € ð �z‰z×#Ò# GÐC°DÒC¸FÑCÐCr   )r]   rŒ  r   )r0   r1   r2   r3   rW   r„  rŒ  r   r"   r.   r(   r�  re   r4   r5   r6   s   @r   r€  r€  ¡  s;   ø‡ € ñð €GØ€Hòò&ò3ôò÷Dð Dr   r€  c                   óT   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V tR# )ÚTimeoutMixinTestsiÒ  z%
Tests for L{policies.TimeoutMixin}.
c                ón   € \         P                  ! 4       V n        \        V P                  4      V n        R# )zI
Create a testable, deterministic clock and a C{TimeoutTester} instance.
N)r
   r5  r]   r€  r‘   r   s   &r   rm  ÚTimeoutMixinTests.setUp×  s!   € ô —Z’Z“\ˆŒ
Ü" 4§:¡:Ó.ˆŽ
r   c                óš   € V P                   P                  ^
4       V P                  \        V P                  P
                  4      ^4       R# )z‚
Test that the callLater of the clock is used instead of
L{reactor.callLater<twisted.internet.interfaces.IReactorTime.callLater>}
N)r‘   rX  r–   r  r]   Úcallsr   s   &r   Útest_overriddenCallLaterÚ*TimeoutMixinTests.test_overriddenCallLaterÞ  s5   € ð
 	�
‰
×Ñ˜bÔ!Ø×Ñœ˜TŸZ™Z×-Ñ-Ó.°Ö2r   c                óT  € V P                   P                  \        4       4       V P                  P	                  . RO4       V P                  V P                   P                  4       V P                  P	                  ^ R.4       V P                  V P                   P                  4       R# )zY
Check that the protocol does timeout at the time specified by its
C{timeOut} attribute.
rs  N©r  rr  rs  rs  )r‘   rŽ   r   r]   rt  rA  rŒ  r�   r   s   &r   ru  ÚTimeoutMixinTests.test_timeoutæ  sn   € ð
 	�
‰
×!Ñ!¤/Ó"3Ô4ð 	�
‰
�‰Ò*Ô+Ø×Ñ˜Ÿ™×,Ñ,Ô-Ø�
‰
�‰˜˜C˜Ô!Ø�‰˜Ÿ
™
×+Ñ+Ö,r   c                ó  € V P                   P                  \        4       4       V P                  P	                  . RO4       V P                  V P                   P                  4       V P                   P                  R4       V P                  P	                  . RO4       V P                  V P                   P                  4       V P                  P	                  ^ R.4       V P                  V P                   P                  4       R# )zF
Check that receiving data is delaying the timeout of the connection.
rs  s   hello thereNr›  )r  rs  rs  rr  )	r‘   rŽ   r   r]   rt  rA  rŒ  r.   r�   r   s   &r   Útest_noTimeoutÚ TimeoutMixinTests.test_noTimeoutó  s§   € ð 	�
‰
×!Ñ!¤/Ó"3Ô4à�
‰
�‰Ò*Ô+Ø×Ñ˜Ÿ™×,Ñ,Ô-Ø�
‰
×Ñ Ô/Ø�
‰
�‰Ò*Ô+Ø×Ñ˜Ÿ™×,Ñ,Ô-Ø�
‰
�‰˜˜C˜Ô!Ø�‰˜Ÿ
™
×+Ñ+Ö,r   c                óø  € RV P                   n        V P                   P                  \        4       4       V P                   P	                  ^4       V P                  V P                   P                  ^4       V P                  P                  ^ R.4       V P                  V P                   P                  4       V P                  P                  ^ R.4       V P                  V P                   P                  4       R# )za
Check that setting a new value for timeout cancel the previous value
and install a new timeout.
NgÍÌÌÌÌÌì?rq  )r‘   r„  rŽ   r   rX  r–   r]   rt  rA  rŒ  r�   r   s   &r   Útest_resetTimeoutÚ#TimeoutMixinTests.test_resetTimeout  s§   € ð
 "ˆ�
‰
ÔØ�
‰
×!Ñ!¤/Ó"3Ô4à�
‰
×Ñ˜aÔ Ø×Ñ˜Ÿ™×+Ñ+¨QÔ/à�
‰
�‰˜˜C˜Ô!Ø×Ñ˜Ÿ™×,Ñ,Ô-Ø�
‰
�‰˜˜C˜Ô!Ø�‰˜Ÿ
™
×+Ñ+Ö,r   c                ór  € ^V P                   n        V P                   P                  \        4       4       V P                   P	                  R4       V P                  V P                   P                  4       V P                  P                  . RO4       V P                  V P                   P                  4       R# )z?
Setting the timeout to L{None} cancel any timeout operations.
N)r  é   r¤  r¤  )
r‘   r„  rŽ   r   rX  rÂ   r]   rt  rA  rŒ  r   s   &r   r]  Ú$TimeoutMixinTests.test_cancelTimeout  sw   € ð ˆ�
‰
ÔØ�
‰
×!Ñ!¤/Ó"3Ô4à�
‰
×Ñ˜dÔ#Ø×Ñ˜$Ÿ*™*×,Ñ,Ô-à�
‰
�‰šÔ%Ø×Ñ˜Ÿ™×,Ñ,Ö-r   c                óª  € ^V P                   n        V P                  V P                   P                  ^
4      ^4       V P                  V P                   P                  R4      ^
4       V P	                  V P                   P                  ^4      4       V P                  V P                   P                  ^4       V P                   P                  R4       R# )z=
setTimeout should return the value of the previous timeout.
N)r‘   r„  r–   rX  rÂ   r   s   &r   Útest_setTimeoutReturnÚ'TimeoutMixinTests.test_setTimeoutReturn  s™   € ð ˆ�
‰
Ôà×Ñ˜Ÿ™×.Ñ.¨rÓ2°AÔ6Ø×Ñ˜Ÿ™×.Ñ.¨tÓ4°bÔ9Ø×Ñ˜$Ÿ*™*×/Ñ/°Ó2Ô3Ø×Ñ˜Ÿ™×+Ñ+¨QÔ/ð 	�
‰
×Ñ˜dÖ#r   c                ód  € V P                   P                  ^4       V P                  P                  4       ^ ,          P	                  4        V P                  V P                   P                  4       V P                   P                  R4       V P                  V P                   P                  4       R# )z±
When the timeout was already cancelled from an external place,
calling setTimeout with C{None} to explicitly cancel it will clean
up the timeout without raising any exception.
N)r‘   rX  r]   ÚgetDelayedCallsrg  rï   r„  rÂ   r   s   &r   Ú%test_setTimeoutCancleAlreadyCancelledÚ7TimeoutMixinTests.test_setTimeoutCancleAlreadyCancelled,  sx   € ð 	�
‰
×Ñ˜aÔ ð 	�
‰
×"Ñ"Ó$ QÕ'×.Ñ.Ô0Ø×Ñ˜TŸZ™Z×/Ñ/Ô0à�
‰
×Ñ˜dÔ#à×Ñ˜$Ÿ*™*×,Ñ,Ö-r   )r]   r‘   N)r0   r1   r2   r3   rW   rm  r˜  ru  rž  r¡  r]  r§  r«  r4   r5   r6   s   @r   r“  r“  Ò  s7   ø‡ € ñò/ò3ò-ò-ò-ò .ò$÷.ð .r   r“  c                   ó0   a € ] tR tRt o RtR tR tRtV tR# )Ú!LimitTotalConnectionsFactoryTestsi=  z/Tests for policies.LimitTotalConnectionsFactoryc                óú  € \         P                  ! 4       p\        P                  Vn        V P	                  ^ VP
                  4       VP                  R4      pV P	                  ^VP
                  4       VP                  R4      pV P	                  ^VP
                  4       VP                  R4       V P	                  ^VP
                  4       VP                  R4       V P	                  ^ VP
                  4       R# )r  N)r   ÚLimitTotalConnectionsFactoryr   r�   r–   ÚconnectionCountr@   r(   )r   r~   Úp1Úp2s   &   r   ÚtestConnectionCountingÚ8LimitTotalConnectionsFactoryTests.testConnectionCounting@  sÎ   € ä×7Ò7Ó9ˆÜ#×,Ñ,ˆÔð 	×Ñ˜˜G×3Ñ3Ô4ð ×"Ñ" 4Ó(ˆØ×Ñ˜˜G×3Ñ3Ô4Ø×"Ñ" 4Ó(ˆØ×Ñ˜˜G×3Ñ3Ô4ð 	×Ñ˜$ÔØ×Ñ˜˜G×3Ñ3Ô4Ø
×Ñ˜$ÔØ×Ñ˜˜G×3Ñ3Ö4r   c                ó  a€ \         P                  ! 4       o\        P                  Sn        ^Sn        SP                  R4      pV P                  V4       V P                  ^SP                  4       V P                  SP                  R4      4       V P                  ^SP                  4        ! V3R lR\        P                  4      pVSn
        RSn        SP                  R4      pVP                  R4       V P                  SP                  4       V P                  ^SP                  4       VP                  R4       V P                  ^SP                  4       VP                  R4       V P                  ^ SP                  4       R# )r   Nc                   ó.   <a € ] tR tRt o V3R ltRtV tR# )ÚRLimitTotalConnectionsFactoryTests.testConnectionLimiting.<locals>.OverflowProtocolie  c                ó   <€ R Sn         R# rE   )Ú
overflowed)r   r~   s   &€r   r"   ÚaLimitTotalConnectionsFactoryTests.testConnectionLimiting.<locals>.OverflowProtocol.connectionMadef  s   ø€ Ø%)�Ö"r   rN   N)r0   r1   r2   r3   r"   r4   r5   )r7   r~   s   @€r   ÚOverflowProtocolr¸  e  s   ù‡ € ÷*ó *r   r¼  F)r   r°  r   r�   ÚconnectionLimitr@   rï   r–   r±  rÂ   ÚoverflowProtocolrº  rŽ   r�   r(   )r   r<   r¼  Úopr~   s   &   @r   ÚtestConnectionLimitingÚ8LimitTotalConnectionsFactoryTests.testConnectionLimitingT  sD  ø€ ä×7Ò7Ó9ˆÜ#×,Ñ,ˆÔØ"#ˆÔð ×!Ñ! $Ó'ˆØ×Ñ˜QÔØ×Ñ˜˜G×3Ñ3Ô4ð 	×Ñ˜'×/Ñ/°Ó5Ô6Ø×Ñ˜˜G×3Ñ3Ô4÷	*œx×0Ñ0ô 	*ð $4ˆÔ Ø"ˆÔð
 ×"Ñ" 4Ó(ˆØ
×Ñ˜$ÔØ�‰˜×*Ñ*Ô+Ø×Ñ˜˜G×3Ñ3Ô4ð 	
×Ñ˜ÔØ×Ñ˜˜G×3Ñ3Ô4Ø
×Ñ˜$ÔØ×Ñ˜˜G×3Ñ3Ö4r   rN   N)	r0   r1   r2   r3   rW   r´  rÀ  r4   r5   r6   s   @r   r®  r®  =  s   ø‡ € Ù9ò5÷($5ð $5r   r®  c                   ó&   a € ] tR tRt o R tRtV tR# )ÚWriteSequenceEchoProtocoli{  c                ó˜   € VP                  R 4      R8w  d   V P                  P                  V.4       R# \        P	                  W4       R# )s   vector!Néÿÿÿÿ)ÚfindrR   r6  rC   r.   )r   Úbytess   &&r   r.   Ú&WriteSequenceEchoProtocol.dataReceived|  s5   € Ø�:‰:�jÓ! RÔ'Ø�N‰N×(Ñ(¨%¨Ö1ä×%Ñ% dÖ2r   rN   N)r0   r1   r2   r3   r.   r4   r5   r6   s   @r   rÃ  rÃ  {  s   ø‡ € ÷3ð 3r   rÃ  c                   ó*   a € ] tR tRt o RtR tRtV tR# )ÚTestLoggingFactoryiƒ  Nc                ób   € V P                   e   Q R4       h\        4       V n         V P                   # )Nzopen() called too many times)ÚopenFiler   )r   Únames   &&r   ÚopenÚTestLoggingFactory.open†  s+   € Ø�}‰}Ò$ÐDÐ&DÓDÐ$Ü ›
ˆŒØ�}‰}Ðr   )rÌ  )r0   r1   r2   r3   rÌ  rÎ  r4   r5   r6   s   @r   rÊ  rÊ  ƒ  s   ø‡ € Ø€H÷ð r   rÊ  c                   ó6   a € ] tR tRt o RtR tR tR tRtV t	R# )ÚLoggingFactoryTestsiŒ  z.
Tests for L{policies.TrafficLoggingFactory}.
c                óÎ  € \        4       p\        Vn        \        4       p\	        VR4      pVP                  R
4      pWBn        VP                  V4       VP                  P                  4       pV P                  RV4       V P                  VP                  4       4       VP                  R4       VP                  P                  4       pV P                  RP                  R4      V4       V P                  RP                  R4      V4       V P                  VP                  4       R4       VP                  4        VP                  R4       VP                  P                  4       pV P                  RP                  R.4      V4       V P                  VP                  4       R4       VP!                  4        VP                  P                  4       pV P                  RV4       R	# )zA
Check the output produced by L{policies.TrafficLoggingFactory}.
ÚtestÚ*s   here are some bytesz	C 1: {!r}z	S 1: {!r}s"   prepare for vector! to the extremez
SV 1: {!r}ÚConnectionDoneN©ú1.2.3.4i.  )rV   rÃ  r   r   rÊ  r@   rŽ   rÌ  ÚgetvalueÚassertInrA  r7  r.   Úformatr–   rL  rð   )r   rT  Útr   r<   Úvs   &     r   Útest_thingsGetLoggedÚ(LoggingFactoryTests.test_thingsGetLogged‘  sq  € ô  ›ˆÜ";ˆÔÜ,Ó.ˆÜ˜~¨vÓ6ˆØ�O‰OÐ-Ó.ˆØŒ
Ø	×Ñ˜Ôà�J‰J×ÑÓ!ˆØ�‰�c˜1ÔØ×Ñ˜Ÿ™›Ô#à	�‰Ð-Ô.à�J‰J×ÑÓ!ˆØ�‰�k×(Ñ(Ð)?Ó@À!ÔDØ�‰�k×(Ñ(Ð)?Ó@À!ÔDØ×Ñ˜Ÿ™›Ð$:Ô;à	�‰Œ	Ø	�‰Ð<Ô=Ø�J‰J×ÑÓ!ˆØ�‰�l×)Ñ)Ð+PÐ*QÓRÐTUÔVØ×Ñ˜Ÿ™›Ð$IÔJà	×ÑÔà�J‰J×ÑÓ!ˆØ�‰Ð&¨Ö*r   c                ó„  € \        4       p\        VR4      pV P                  VP                  ^ 4       VP	                  R4       V P                  VP                  ^4       RVn        VP	                  R4       V P                  VP                  ^4       VP                  4        V P                  VP                  ^ 4       R# )z7
Test counter management with the resetCounter method.
rÓ  NrÖ  )r×  i/  )rV   rÊ  r–   Ú_counterr@   rÌ  ÚresetCounter)r   rT  r   s   &  r   Útest_counterÚ LoggingFactoryTests.test_counter³  s’   € ô  ›ˆÜ˜~¨vÓ6ˆØ×Ñ˜Ÿ™ QÔ'Ø	�‰Ð)Ô*Ø×Ñ˜Ÿ™ QÔ'àˆŒ
Ø	�‰Ð)Ô*Ø×Ñ˜Ÿ™ QÔ'à	�‰ÔØ×Ñ˜Ÿ™ QÖ'r   c                óÞ  aa	€ . o. o	VV	3R lpV P                  \        RV4       \        P                  ! 4       p\        Vn        \
        P                  ! VR4      pVP                  \        P                  ! RRR4      4      pVP                  \        P                  ! RRR4      4      pR	/ 3pR
/ 3pV P                  Wg.S4       V P                  VP                  VP                  .S	4       R# )zª
When the L{policies.TrafficLoggingFactory} builds a protocol, it
automatically opens a unique log file for that protocol and attaches
the logfile to the built protocol.
c                 ó~   <€ SP                  W34       \        4       pV ^ ,          Vn        SP                  V4       V# )z@
Mock for the open call to prevent actually opening a log file.
)rÈ   r   rÍ  )r_   r`   ÚioÚ
open_callsÚopen_rvaluess   *, €€r   Úmocked_openÚULoggingFactoryTests.test_loggingFactoryOpensLogfileAutomatically.<locals>.mocked_openÍ  s:   ø€ ð ×Ñ˜t˜nÔ-Ü“ˆBØ˜1•gˆBŒGØ×Ñ Ô#ØˆIr   rÎ  rÓ  rx   ry   rR  i:0  N)ztest-1Úw)ztest-2rë  )ÚpatchÚbuiltinsr   rS  r   r   ÚTrafficLoggingFactoryr@   r   r{   r–   Úlogfile)
r   ré  rT  r~   Úfirst_protoÚsecond_protoÚ
first_callÚsecond_callrç  rè  s
   &       @@r   Ú,test_loggingFactoryOpensLogfileAutomaticallyÚ@LoggingFactoryTests.test_loggingFactoryOpensLogfileAutomaticallyÄ  sÞ   ù€ ð ˆ
Øˆö	ð 	�
‰
”8˜V [Ô1ä!×/Ò/Ó1ˆÜ"0ˆÔÜ×0Ò0°ÀÓHˆØ×+Ñ+Ü×Ò  {°EÓ:ó
ˆð ×,Ñ,Ü×Ò  {°EÓ:ó
ˆð & rÐ*ˆ
Ø&¨Ð+ˆØ×Ñ˜*Ð2°JÔ?Ø×Ñ˜+×-Ñ-¨|×/CÑ/CÐDÀlÖSr   rN   N)
r0   r1   r2   r3   rW   rÝ  râ  rô  r4   r5   r6   s   @r   rÑ  rÑ  Œ  s!   ø‡ € ñò +òD(÷"$Tð $Tr   rÑ  ).rW   rí  ræ  r   Úzope.interfacer   r   r   Útwisted.internetr   r   r   r	   r
   Útwisted.internet.testingr   r   Útwisted.protocolsr   Útwisted.trialr   r�   r   ÚClientFactoryr9   rC   rS  rV   r\   rY   rq   ro   ÚTestCaserv   rz   rû   rP  rk  ÚTimeoutMixinr€  r“  r®  rÃ  rî  rÊ  rÑ  rN   r   r   Ú<module>rþ     sr  ðñó
 Ý ç @Ñ @ç DÕ Dß VÝ &Ý "ô�X×&Ñ&ô ô(�8×)Ñ)ô ô#�8×$Ñ$ô #ô ˆX×#Ñ#ô ô2 × :Ñ :ô 2ô*2˜X×4Ñ4ô 2ô*Z3�8×$Ñ$ô Z3ôz%�h×.Ñ.ô %ôY8�h×'Ñ'ô Y8ôxU;˜8×,Ñ,ô U;ôpR8˜(×+Ñ+ô R8ôj.D�H×%Ñ% x×'<Ñ'<ô .Dôbh.˜×)Ñ)ô h.ôV;5¨×(9Ñ(9ô ;5ô|3 ô 3ô˜×7Ñ7ô ô\T˜(×+Ñ+ö \Tr   