§
    ÈtºfHr  ã                   óF  — d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	  ed¦  «        Z
ddlmZ e
r	dd	lmZmZ n G d
„ d¦  «        Z G d„ dej        ¦  «        Z G d„ d¦  «        Z G d„ dej        ¦  «        Z G d„ de	j        ¦  «        Z G d„ de	j        ¦  «        ZdS )z1
This module tests twisted.conch.ssh.connection.
é    N)Úchannel)Útest_userauth)ÚrequireModule)ÚunittestÚcryptography)Úerror)ÚcommonÚ
connectionc                   ó(   — e Zd Z G d„ d¦  «        ZdS )r
   c                   ó   — e Zd ZdS )úconnection.SSHConnectionN)Ú__name__Ú
__module__Ú__qualname__© ó    úa/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/conch/test/test_connection.pyÚSSHConnectionr      s   € € € € € ØˆDr   r   N)r   r   r   r   r   r   r   r
   r
      s<   € € € € € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	r   r
   c                   óT   — e Zd ZdZdZdZdZd„ Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zd„ Zd„ ZdS )ÚTestChannelaÒ  
    A mocked-up version of twisted.conch.ssh.channel.SSHChannel.

    @ivar gotOpen: True if channelOpen has been called.
    @type gotOpen: L{bool}
    @ivar specificData: the specific channel open data passed to channelOpen.
    @type specificData: L{bytes}
    @ivar openFailureReason: the reason passed to openFailed.
    @type openFailed: C{error.ConchError}
    @ivar inBuffer: a C{list} of strings received by the channel.
    @type inBuffer: C{list}
    @ivar extBuffer: a C{list} of 2-tuples (type, extended data) of received by
        the channel.
    @type extBuffer: C{list}
    @ivar numberRequests: the number of requests that have been made to this
        channel.
    @type numberRequests: L{int}
    @ivar gotEOF: True if the other side sent EOF.
    @type gotEOF: L{bool}
    @ivar gotOneClose: True if the other side closed the connection.
    @type gotOneClose: L{bool}
    @ivar gotClosed: True if the channel is closed.
    @type gotClosed: L{bool}
    ó   TestChannelFc                 ó   — d| j         z  S )NzTestChannel %i)Úid©Úselfs    r   Ú	logPrefixzTestChannel.logPrefix:   s   € Ø $¤'Ñ)Ð)r   c                 óv   — d| _         || _        g | _        g | _        d| _        d| _        d| _        d| _        dS )zF
        The channel is open.  Set up the instance variables.
        Tr   FN)ÚgotOpenÚspecificDataÚinBufferÚ	extBufferÚnumberRequestsÚgotEOFÚgotOneCloseÚ	gotClosed)r   r   s     r   ÚchannelOpenzTestChannel.channelOpen=   sC   € ð ˆŒØ(ˆÔØˆŒØˆŒØˆÔØˆŒØ ˆÔØˆŒˆˆr   c                 ó   — || _         dS )zD
        Opening the channel failed.  Store the reason why.
        N)ÚopenFailureReason)r   Úreasons     r   Ú
openFailedzTestChannel.openFailedJ   s   € ð "(ˆÔÐÐr   c                 ó.   — | xj         dz  c_         |dk    S )z_
        A test request.  Return True if data is 'data'.

        @type data: L{bytes}
        é   ó   data)r"   ©r   Údatas     r   Úrequest_testzTestChannel.request_testP   s"   € ð 	ÐÔ˜qÑ ÐÔØ�wŠÐr   c                 ó:   — | j                              |¦  «         dS )z=
        Data was received.  Store it in the buffer.
        N)r    Úappendr.   s     r   ÚdataReceivedzTestChannel.dataReceivedY   s    € ð 	Œ×Ò˜TÑ"Ô"Ð"Ð"Ð"r   c                 ó>   — | j                              ||f¦  «         dS )zF
        Extended data was received.  Store it in the buffer.
        N)r!   r2   )r   Úcoder/   s      r   ÚextReceivedzTestChannel.extReceived_   s$   € ð 	Œ×Ò˜t T˜lÑ+Ô+Ð+Ð+Ð+r   c                 ó   — d| _         dS )z1
        EOF was received.  Remember it.
        TN)r#   r   s    r   ÚeofReceivedzTestChannel.eofReceivede   s   € ð ˆŒˆˆr   c                 ó   — d| _         dS )z3
        Close was received.  Remember it.
        TN)r$   r   s    r   ÚcloseReceivedzTestChannel.closeReceivedk   s   € ð  ˆÔÐÐr   c                 ó   — d| _         dS )z7
        The channel is closed.  Rembember it.
        TN)r%   r   s    r   ÚclosedzTestChannel.closedq   s   € ð ˆŒˆˆr   N)r   r   r   Ú__doc__Únamer   r%   r   r&   r*   r0   r3   r6   r8   r:   r<   r   r   r   r   r      s¶   € € € € € ðð ð2 €DØ€GØ€Ið*ð *ð *ðð ð ð(ð (ð (ðð ð ð#ð #ð #ð,ð ,ð ,ðð ð ð ð  ð  ðð ð ð ð r   r   c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )Ú
TestAvatarz?
    A mocked-up version of twisted.conch.avatar.ConchUser
    é{   c                 óŒ   — |t           j        k    rt          |||| ¬¦  «        S |dk    rt          j        | j        d¦  «        ‚dS )z’
        The server wants us to return a channel.  If the requested channel is
        our TestChannel, return it, otherwise return None.
        )ÚremoteWindowÚremoteMaxPacketr/   Úavataró   conch-error-argsúerror args in wrong orderN)r   r>   r   Ú
ConchErrorÚ_ARGS_ERROR_CODE)r   ÚchannelTypeÚ
windowSizeÚ	maxPacketr/   s        r   ÚlookupChannelzTestAvatar.lookupChannel   sd   € ð
 �+Ô*Ò*Ð*ÝØ'Ø )ØØð	ñ ô ð ð Ð/Ò/Ð/õ
 Ô" 4Ô#8Ð:UÑVÔVÐVð 0Ð/r   c                 ó*   — |dk    rdS |dk    rd|fS dS )zû
        The client has made a global request.  If the global request is
        'TestGlobal', return True.  If the global request is 'TestData',
        return True and the request-specific data we received.  Otherwise,
        return False.
        ó
   TestGlobalTó   TestDataFr   )r   ÚrequestTyper/   s      r   ÚgotGlobalRequestzTestAvatar.gotGlobalRequest’   s.   € ð ˜-Ò'Ð'Ø�4Ø˜KÒ'Ð'Ø˜�:Ðà�5r   N)r   r   r   r=   rI   rM   rR   r   r   r   r@   r@   x   sG   € € € € € ðð ð ÐðWð Wð Wð&ð ð ð ð r   r@   c                   ó8   — e Zd ZdZesdZd„ Zd„ Zd„ Zd„ Z	d„ Z
dS )	ÚTestConnectionz}
    A subclass of SSHConnection for testing.

    @ivar channel: the current channel.
    @type channel. C{TestChannel}
    úCannot run without cryptographyc                 ó   — dS )NrT   r   r   s    r   r   zTestConnection.logPrefix¬   s   € ØÐr   c                 ó   — dS )zT
        The other side made the 'TestGlobal' global request.  Return True.
        Tr   r.   s     r   Úglobal_TestGlobalz TestConnection.global_TestGlobal¯   s	   € ð ˆtr   c                 ó
   — d|fS )zt
        The other side made the 'Test-Data' global request.  Return True and
        the data we received.
        Tr   r.   s     r   Úglobal_Test_DatazTestConnection.global_Test_Dataµ   s   € ð
 �TˆzÐr   c                 ó>   — t          |||¬¦  «        | _        | j        S )zƒ
        The other side is requesting the TestChannel.  Create a C{TestChannel}
        instance, store it, and return it.
        )rC   rD   r/   )r   r   ©r   rK   rL   r/   s       r   Úchannel_TestChannelz"TestConnection.channel_TestChannel¼   s+   € õ
 #Ø#°YÀTð
ñ 
ô 
ˆŒð Œ|Ðr   c                 ó    — t          d¦  «        ‚)zU
        The other side is requesting the ErrorChannel.  Raise an exception.
        zno such thing)ÚAssertionErrorr\   s       r   Úchannel_ErrorChannelz#TestConnection.channel_ErrorChannelÆ   s   € õ ˜_Ñ-Ô-Ð-r   N)r   r   r   r=   r   Úskipr   rX   rZ   r]   r`   r   r   r   rT   rT   ¡   sx   € € € € € ðð ð ð 1Ø0ˆð ð  ð  ðð ð ðð ð ðð ð ð.ð .ð .ð .ð .r   rT   c                   óÜ   — e Zd ZesdZd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d „ Z#d!„ Z$d"„ Z%d#S )$ÚConnectionTestsrU   c                 óâ   — t          j        d ¦  «        | _        t          ¦   «         | j        _        t          ¦   «         | _        | j        | j        _        | j                             ¦   «          d S ©N)r   ÚFakeTransportÚ	transportr@   rE   rT   ÚconnÚserviceStartedr   s    r   ÚsetUpzConnectionTests.setUpÑ   sU   € Ý&Ô4°TÑ:Ô:ˆŒÝ *¡¤ˆŒÔÝ"Ñ$Ô$ˆŒ	Ø"œnˆŒ	ÔØŒ	× Ò Ñ"Ô"Ð"Ð"Ð"r   c                 óâ   — | j                              |¦  «         | j        j        dd…         | j        _        | j                              t          j        d|j        d¦  «        dz   ¦  «         dS )z?
        Open the channel with the default connection.
        Néÿÿÿÿz>2Léÿ   s        € )rh   ÚopenChannelrg   ÚpacketsÚssh_CHANNEL_OPEN_CONFIRMATIONÚstructÚpackr   ©r   r   s     r   Ú_openChannelzConnectionTests._openChannelØ   so   € ð 	Œ	×Ò˜gÑ&Ô&Ð&Ø!%¤Ô!7¸¸¸Ô!<ˆŒÔØŒ	×/Ò/ÝŒK˜˜wœz¨3Ñ/Ô/Ð2UÑUñ	
ô 	
ð 	
ð 	
ð 	
r   c                 ó8   — | j                              ¦   «          d S re   )rh   ÚserviceStoppedr   s    r   ÚtearDownzConnectionTests.tearDownâ   s   € ØŒ	× Ò Ñ"Ô"Ð"Ð"Ð"r   c                 óZ   — |                       | j        j        j        | j        ¦  «         dS )z_
        Test that the connection links itself to the avatar in the
        transport.
        N)ÚassertIsrg   rE   rh   r   s    r   Útest_linkAvatarzConnectionTests.test_linkAvatarå   s(   € ð
 	�Š�d”nÔ+Ô0°$´)Ñ<Ô<Ð<Ð<Ð<r   c                 óº  — t          ¦   «         }t          ¦   «         }| j                             |¦  «         | j                             |¦  «         | j                             d¦  «         |                      |j        ¦  «         |                      |j        ¦  «         |                      |j        ¦  «         |                      |j        ¦  «         | j                             ¦   «          |                      |j        ¦  «         |                      |j        ¦  «         |                      |j        ¦  «         ddl	m
} |                      |j        |¦  «         dS )zF
        Test that serviceStopped() closes any open channels.
        s                   r   )ÚConnectionLostN)r   rh   rn   rp   Ú
assertTruer   ÚassertFalser%   rv   Útwisted.internet.errorr|   ÚassertIsInstancer(   )r   Úchannel1Úchannel2r|   s       r   Útest_serviceStoppedz#ConnectionTests.test_serviceStoppedì   s;  € õ ‘=”=ˆÝ‘=”=ˆØŒ	×Ò˜hÑ'Ô'Ð'ØŒ	×Ò˜hÑ'Ô'Ð'ØŒ	×/Ò/Ð0GÑHÔHÐHØ�Š˜Ô(Ñ)Ô)Ð)Ø×Ò˜Ô+Ñ,Ô,Ð,Ø×Ò˜Ô)Ñ*Ô*Ð*Ø×Ò˜Ô+Ñ,Ô,Ð,ØŒ	× Ò Ñ"Ô"Ð"Ø�Š˜Ô*Ñ+Ô+Ð+Ø×Ò˜Ô)Ñ*Ô*Ð*Ø×Ò˜Ô+Ñ,Ô,Ð,Ø9Ð9Ð9Ð9Ð9Ð9à×Ò˜hÔ8¸.ÑIÔIÐIÐIÐIr   c                 ó  — | j                              t          j        d¦  «        dz   ¦  «         |                      | j        j        t          j        dfg¦  «         g | j        _        | j                              t          j        d¦  «        dz   dz   ¦  «         |                      | j        j        t          j        dfg¦  «         g | j        _        | j                              t          j        d¦  «        dz   ¦  «         |                      | j        j        t          j	        dfg¦  «         g | j        _        | j                              t          j        d¦  «        dz   ¦  «         |                      | j        j        g ¦  «         dS )	z°
        Test that global request packets are dispatched to the global_*
        methods and the return values are translated into success or failure
        messages.
        rO   ó   ÿr   rP   s	   test datas   TestBadó    N)
rh   Ússh_GLOBAL_REQUESTr	   ÚNSÚassertEqualrg   ro   r
   ÚMSG_REQUEST_SUCCESSÚMSG_REQUEST_FAILUREr   s    r   Útest_GLOBAL_REQUESTz#ConnectionTests.test_GLOBAL_REQUEST  si  € ð 	Œ	×$Ò$¥V¤Y¨}Ñ%=Ô%=ÀÑ%GÑHÔHÐHØ×ÒØŒNÔ"¥jÔ&DÀcÐ%JÐ$Kñ	
ô 	
ð 	
ð "$ˆŒÔØŒ	×$Ò$¥V¤Y¨{Ñ%;Ô%;¸gÑ%EÈÑ%TÑUÔUÐUØ×ÒØŒNÔ"¥jÔ&DÀlÐ%SÐ$Tñ	
ô 	
ð 	
ð "$ˆŒÔØŒ	×$Ò$¥V¤Y¨zÑ%:Ô%:¸WÑ%DÑEÔEÐEØ×ÒØŒNÔ"¥jÔ&DÀcÐ%JÐ$Kñ	
ô 	
ð 	
ð "$ˆŒÔØŒ	×$Ò$¥V¤Y¨}Ñ%=Ô%=ÀÑ%GÑHÔHÐHØ×Ò˜œÔ/°Ñ4Ô4Ð4Ð4Ð4r   c                 óÜ   ‡ — ‰ j                              ddd¦  «        }‰ j                              d¦  «         ˆ fd„}|                     |¦  «         |                     ‰ j        ¦  «         |S )zh
        Test that global request success packets cause the Deferred to be
        called back.
        ó   requestr-   Tc                 ó4   •— ‰                      | d¦  «         d S ©Nr-   )r‰   )r/   r   s    €r   Úcheckz3ConnectionTests.test_REQUEST_SUCCESS.<locals>.check!  s   ø€ Ø×Ò˜T 7Ñ+Ô+Ð+Ð+Ð+r   )rh   ÚsendGlobalRequestÚssh_REQUEST_SUCCESSÚaddCallbackÚ
addErrbackÚfail©r   Údr‘   s   `  r   Útest_REQUEST_SUCCESSz$ConnectionTests.test_REQUEST_SUCCESS  sz   ø€ ð
 ŒI×'Ò'¨
°G¸TÑBÔBˆØŒ	×%Ò% gÑ.Ô.Ð.ð	,ð 	,ð 	,ð 	,ð 	,ð 	
�Š�eÑÔÐØ	�Š�T”YÑÔÐØˆr   c                 óÜ   ‡ — ‰ j                              ddd¦  «        }‰ j                              d¦  «         ˆ fd„}|                     ‰ j        ¦  «         |                     |¦  «         |S )zg
        Test that global request failure packets cause the Deferred to be
        erred back.
        rŽ   r-   Tc                 óH   •— ‰                      | j        j        d¦  «         d S r�   )r‰   Úvaluer/   )Úfr   s    €r   r‘   z3ConnectionTests.test_REQUEST_FAILURE.<locals>.check0  s#   ø€ Ø×Ò˜QœWœ\¨7Ñ3Ô3Ð3Ð3Ð3r   )rh   r’   Ússh_REQUEST_FAILUREr”   r–   r•   r—   s   `  r   Útest_REQUEST_FAILUREz$ConnectionTests.test_REQUEST_FAILURE(  sz   ø€ ð
 ŒI×'Ò'¨
°G¸TÑBÔBˆØŒ	×%Ò% gÑ.Ô.Ð.ð	4ð 	4ð 	4ð 	4ð 	4ð 	
�Š�d”iÑ Ô Ð Ø	�Š�UÑÔÐØˆr   c                 ó(  — | j         `| j                             t	          j        d¦  «        dz   ¦  «         |                      | j        j        j        ¦  «         |  	                    | j        j        j        | j        ¦  «         |  	                    | j        j        j
        d¦  «         |  	                    | j        j        j        d¦  «         |  	                    | j        j        j        d¦  «         |  	                    | j        j        j        d¦  «         |  	                    | j         j        t          j        dfg¦  «         g | j         _        | j                             t	          j        d¦  «        dz   ¦  «         |                      ¦   «          |  	                    | j         j        t          j        dt	          j        d	¦  «        z   t	          j        d
¦  «        z   fg¦  «         g | j         _        | j                             t	          j        d¦  «        dz   ¦  «         |                      ¦   «          |  	                    | j         j        t          j        dt	          j        d¦  «        z   t	          j        d
¦  «        z   fg¦  «         dS )z†
        Test that open channel packets cause a channel to be created and
        opened or a failure message to be returned.
        r   ó               ó      r,   s               € ó
   BadChannels               s         s   unknown channelr   s   ErrorChannels         s   unknown failureN)rg   rE   rh   Ússh_CHANNEL_OPENr	   rˆ   r}   r   r   r‰   r/   r   ÚremoteWindowLeftrD   ro   r
   ÚMSG_CHANNEL_OPEN_CONFIRMATIONÚflushLoggedErrorsÚMSG_CHANNEL_OPEN_FAILUREr   s    r   Útest_CHANNEL_OPENz!ConnectionTests.test_CHANNEL_OPEN7  s_  € ð
 ŒNÐ!ØŒ	×"Ò"¥6¤9¨^Ñ#<Ô#<Ð?VÑ#VÑWÔWÐWØ�Š˜œ	Ô)Ô1Ñ2Ô2Ð2Ø×Ò˜œÔ*Ô/°´Ñ;Ô;Ð;Ø×Ò˜œÔ*Ô/Ð1DÑEÔEÐEØ×Ò˜œÔ*Ô7Ð9LÑMÔMÐMØ×Ò˜œÔ*Ô;¸QÑ?Ô?Ð?Ø×Ò˜œÔ*Ô:¸AÑ>Ô>Ð>Ø×ÒØŒNÔ"õ Ô<ð(ððñ		
ô 		
ð 		
ð "$ˆŒÔØŒ	×"Ò"¥6¤9¨]Ñ#;Ô#;Ð>UÑ#UÑVÔVÐVØ×ÒÑ Ô Ð Ø×ÒØŒNÔ"õ Ô7Ø7Ý”iÐ 2Ñ3Ô3ñ4å”i ‘n”nñ%ððñ
	
ô 
	
ð 
	
ð "$ˆŒÔØŒ	×"Ò"¥6¤9¨_Ñ#=Ô#=Ð@WÑ#WÑXÔXÐXØ×ÒÑ Ô Ð Ø×ÒØŒNÔ"õ Ô7Ø7Ý”iÐ 2Ñ3Ô3ñ4å”i ‘n”nñ%ððñ
	
ô 
	
ð 
	
ð 
	
ð 
	
r   c                 ó  — || j         j        _        | j                             t          j        d¦  «        dz   ¦  «         |                      t          j	        ¦  «        }|  
                    t          |¦  «        dd|›�¦  «         |  
                    |d         j        j        d¦  «         |  
                    | j         j        t          j        dt          j        d¦  «        z   t          j        d	¦  «        z   fg¦  «         d
S )zÅ
        Deliver a request for a channel open which will result in an exception
        being raised during channel lookup.  Assert that an error response is
        delivered as a result.
        rF   r¡   r,   zExpected one error, got: r   )rA   rG   s         {s   error args in wrong orderr   N)rg   rE   rI   rh   r¤   r	   rˆ   r§   r   rH   r‰   Úlenrœ   Úargsro   r
   r¨   )r   r5   Úerrorss      r   Ú_lookupChannelErrorTestz'ConnectionTests._lookupChannelErrorTestk  s  € ð 26ˆŒÔÔ.ØŒ	×"Ò"ÝŒIÐ)Ñ*Ô*Ð-DÑDñ	
ô 	
ð 	
ð ×'Ò'­Ô(8Ñ9Ô9ˆØ×Ò�˜V™œ aÐ)OÀVÐ)OÐ)OÑPÔPÐPØ×Ò˜ œœÔ-Ð/QÑRÔRÐRØ×ÒØŒNÔ"õ Ô7ð 8Ý”iÐ <Ñ=Ô=ñ>å”i ‘n”nñ%ðð
ñ	
ô 	
ð 	
ð 	
ð 	
r   c                 ó0   — |                       d¦  «         dS )aÔ  
        If a C{lookupChannel} implementation raises L{error.ConchError} with the
        arguments in the wrong order, a C{MSG_CHANNEL_OPEN} failure is still
        sent in response to the message.

        This is a temporary work-around until L{error.ConchError} is given
        better attributes and all of the Conch code starts constructing
        instances of it properly.  Eventually this functionality should be
        deprecated and then removed.
        rA   N)r®   r   s    r   Útest_lookupChannelErrorz'ConnectionTests.test_lookupChannelError‡  s   € ð 	×$Ò$ SÑ)Ô)Ð)Ð)Ð)r   c                 óÄ  — t          ¦   «         }| j                             |¦  «         | j                             d¦  «         |                      |j        d¦  «         |                      |j        d¦  «         |                      |j        d¦  «         |                      | j        j        |         d¦  «         |                      | j        j	        d         d¦  «         dS )zv
        Test that channel open confirmation packets cause the channel to be
        notified that it's open.
        s                       r   ó       N)
r   rh   rn   rp   r‰   r¥   rD   r   ÚchannelsToRemoteChannelÚlocalToRemoteChannelrs   s     r   Útest_CHANNEL_OPEN_CONFIRMATIONz.ConnectionTests.test_CHANNEL_OPEN_CONFIRMATION”  sÌ   € õ
 ‘-”-ˆØŒ	×Ò˜gÑ&Ô&Ð&ØŒ	×/Ò/Ð0GÑHÔHÐHØ×Ò˜Ô1°1Ñ5Ô5Ð5Ø×Ò˜Ô0°!Ñ4Ô4Ð4Ø×Ò˜Ô-Ð/BÑCÔCÐCØ×Ò˜œÔ:¸7ÔCÀQÑGÔGÐGØ×Ò˜œÔ7¸Ô:¸AÑ>Ô>Ð>Ð>Ð>r   c                 óX  — t          ¦   «         }| j                             |¦  «         | j                             dt	          j        d¦  «        z   ¦  «         |                      |j        j        d¦  «         |  	                    | j        j
                             |¦  «        ¦  «         dS )zz
        Test that channel open failure packets cause the channel to be
        notified that its opening failed.
        ó          ó   failure!)r¸   r,   N)r   rh   rn   Ússh_CHANNEL_OPEN_FAILUREr	   rˆ   r‰   r(   r¬   ÚassertIsNoneÚchannelsÚgetrs   s     r   Útest_CHANNEL_OPEN_FAILUREz)ConnectionTests.test_CHANNEL_OPEN_FAILURE¢  s›   € õ
 ‘-”-ˆØŒ	×Ò˜gÑ&Ô&Ð&ØŒ	×*Ò*Ø3µf´iÀÑ6LÔ6LÑLñ	
ô 	
ð 	
ð 	×Ò˜Ô2Ô7Ð9IÑJÔJÐJØ×Ò˜$œ)Ô,×0Ò0°Ñ9Ô9Ñ:Ô:Ð:Ð:Ð:r   c                 óÊ   — t          ¦   «         }|                      |¦  «         |j        }| j                             d¦  «         |                      |j        |dz   ¦  «         dS )zc
        Test that channel window adjust messages add bytes to the channel
        window.
        r·   r,   N)r   rt   r¥   rh   Ússh_CHANNEL_WINDOW_ADJUSTr‰   )r   r   ÚoldWindowSizes      r   Útest_CHANNEL_WINDOW_ADJUSTz*ConnectionTests.test_CHANNEL_WINDOW_ADJUST¯  sd   € õ
 ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØÔ0ˆØŒ	×+Ò+Ð,SÑTÔTÐTØ×Ò˜Ô1°=À1Ñ3DÑEÔEÐEÐEÐEr   c                 óÊ  — t          dd¬¦  «        }|                      |¦  «         | j                             dt	          j        d¦  «        z   ¦  «         |                      |j        dg¦  «         |                      | j        j	        t          j        dfg¦  «         g | j        _	        d|j        dz   z  }| j                             dt	          j        |¦  «        z   ¦  «         |                      |j        dg¦  «         |                      | j        j	        t          j        d	fg¦  «         t          ¦   «         }|                      |¦  «         d|j        dz   z  }g | j        _	        | j                             d
t	          j        |¦  «        z   ¦  «         |                      |j        g ¦  «         |                      | j        j	        t          j        d	fg¦  «         dS )z“
        Test that channel data messages are passed up to the channel, or
        cause the channel to be closed if the data is too large.
        é   é   ©ÚlocalWindowÚlocalMaxPacketr²   r-   ó      ÿ   ó   ar,   ó      ÿr¢   N)r   rt   rh   Ússh_CHANNEL_DATAr	   rˆ   r‰   r    rg   ro   r
   ÚMSG_CHANNEL_WINDOW_ADJUSTÚlocalWindowLeftÚMSG_CHANNEL_CLOSErÇ   ©r   r   ÚlongDataÚbigDatas       r   Útest_CHANNEL_DATAz!ConnectionTests.test_CHANNEL_DATAº  sá  € õ
 ¨!¸AÐ>Ñ>Ô>ˆØ×Ò˜'Ñ"Ô"Ð"ØŒ	×"Ò"Ð#6½¼À7Ñ9KÔ9KÑ#KÑLÔLÐLØ×Ò˜Ô)¨G¨9Ñ5Ô5Ð5Ø×ÒØŒNÔ"õ Ô8Ø;ððñ	
ô 	
ð 	
ð "$ˆŒÔØ˜7Ô2°QÑ6Ñ7ˆØŒ	×"Ò"Ð#6½¼À8Ñ9LÔ9LÑ#LÑMÔMÐMØ×Ò˜Ô)¨G¨9Ñ5Ô5Ð5Ø×ÒØŒNÔ"ÝÔ*Ð,?Ð@ÐAñ	
ô 	
ð 	
õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"Ø˜'Ô0°1Ñ4Ñ5ˆØ!#ˆŒÔØŒ	×"Ò"Ð#6½¼À7Ñ9KÔ9KÑ#KÑLÔLÐLØ×Ò˜Ô)¨2Ñ.Ô.Ð.Ø×ÒØŒNÔ"ÝÔ*Ð,?Ð@ÐAñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óÊ  — t          dd¬¦  «        }|                      |¦  «         | j                             dt	          j        d¦  «        z   ¦  «         |                      |j        dg¦  «         |                      | j        j	        t          j        dfg¦  «         g | j        _	        d|j        d	z   z  }| j                             dt	          j        |¦  «        z   ¦  «         |                      |j        dg¦  «         |                      | j        j	        t          j        d
fg¦  «         t          ¦   «         }|                      |¦  «         d|j        d	z   z  }g | j        _	        | j                             dt	          j        |¦  «        z   ¦  «         |                      |j        g ¦  «         |                      | j        j	        t          j        d
fg¦  «         dS )z–
        Test that channel extended data messages are passed up to the channel,
        or cause the channel to be closed if they're too big.
        rÃ   rÄ   rÅ   s           r-   )r   r-   rÈ   rÉ   r,   rÊ   s          N)r   rt   rh   Ússh_CHANNEL_EXTENDED_DATAr	   rˆ   r‰   r!   rg   ro   r
   rÌ   rÍ   rÎ   rÇ   rÏ   s       r   Útest_CHANNEL_EXTENDED_DATAz*ConnectionTests.test_CHANNEL_EXTENDED_DATAß  sù  € õ
 ¨!¸AÐ>Ñ>Ô>ˆØ×Ò˜'Ñ"Ô"Ð"ØŒ	×+Ò+Ø3µf´iÀÑ6HÔ6HÑHñ	
ô 	
ð 	
ð 	×Ò˜Ô*¨\¨NÑ;Ô;Ð;Ø×ÒØŒNÔ"õ Ô8Ø;ððñ	
ô 	
ð 	
ð "$ˆŒÔØ˜7Ô2°QÑ6Ñ7ˆØŒ	×+Ò+Ø3µf´iÀÑ6IÔ6IÑIñ	
ô 	
ð 	
ð 	×Ò˜Ô*¨\¨NÑ;Ô;Ð;Ø×ÒØŒNÔ"ÝÔ*Ð,?Ð@ÐAñ	
ô 	
ð 	
õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"Ø˜'Ô0°1Ñ4Ñ5ˆØ!#ˆŒÔØŒ	×+Ò+Ø3µf´iÀÑ6HÔ6HÑHñ	
ô 	
ð 	
ð 	×Ò˜Ô*¨BÑ/Ô/Ð/Ø×ÒØŒNÔ"ÝÔ*Ð,?Ð@ÐAñ	
ô 	
ð 	
ð 	
ð 	
r   c                 ó´   — t          ¦   «         }|                      |¦  «         | j                             d¦  «         |                      |j        ¦  «         dS )zN
        Test that channel eof messages are passed up to the channel.
        r²   N)r   rt   rh   Ússh_CHANNEL_EOFr}   r#   rs   s     r   Útest_CHANNEL_EOFz ConnectionTests.test_CHANNEL_EOF
  sR   € õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒ	×!Ò!Ð"5Ñ6Ô6Ð6Ø�Š˜œÑ'Ô'Ð'Ð'Ð'r   c                 ó¸  — t          ¦   «         }|                      |¦  «         |                      |j        ¦  «         |                      |j        ¦  «         |                      |j        ¦  «         | j                             |¦  «         | j         	                    d¦  «         |                      |j        ¦  «         |                      |j        ¦  «         dS )zÃ
        Test that channel close messages are passed up to the channel.  Also,
        test that channel.close() is called if both sides are closed when this
        message is received.
        r²   N)
r   rt   r}   r   r~   r$   r%   rh   Ú	sendCloseÚssh_CHANNEL_CLOSErs   s     r   Útest_CHANNEL_CLOSEz"ConnectionTests.test_CHANNEL_CLOSE  sÀ   € õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"Ø�Š˜œÑ(Ô(Ð(Ø×Ò˜Ô,Ñ-Ô-Ð-Ø×Ò˜Ô*Ñ+Ô+Ð+ØŒ	×Ò˜GÑ$Ô$Ð$ØŒ	×#Ò#Ð$7Ñ8Ô8Ð8Ø�Š˜Ô+Ñ,Ô,Ð,Ø�Š˜Ô)Ñ*Ô*Ð*Ð*Ð*r   c                 ó†  ‡ — t          ¦   «         }‰                      |¦  «         ‰ j                             dt	          j        d¦  «        z   dz   ¦  «         ‰                      |j        d¦  «         ‰ j                             dt	          j        d¦  «        z   dz   dz   ¦  «        }ˆ fd„}|                     |¦  «         |S )zS
        Test that channel requests that succeed send MSG_CHANNEL_SUCCESS.
        r²   ó   testr†   r,   r…   r-   c                 ób   •— ‰                      ‰j        j        t          j        dfg¦  «         d S ©NrÊ   )r‰   rg   ro   r
   ÚMSG_CHANNEL_SUCCESS©Úresultr   s    €r   r‘   z;ConnectionTests.test_CHANNEL_REQUEST_success.<locals>.check1  ó<   ø€ Ø×ÒØ”Ô&ÝÔ0Ð2EÐFÐGñô ð ð ð r   )	r   rt   rh   Ússh_CHANNEL_REQUESTr	   rˆ   r‰   r"   r”   ©r   r   r˜   r‘   s   `   r   Útest_CHANNEL_REQUEST_successz,ConnectionTests.test_CHANNEL_REQUEST_success#  sÓ   ø€ õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒ	×%Ò%Ø¥&¤)¨GÑ"4Ô"4Ñ4°wÑ>ñ	
ô 	
ð 	
ð 	×Ò˜Ô/°Ñ3Ô3Ð3ØŒI×)Ò)Ø¥&¤)¨GÑ"4Ô"4Ñ4°wÑ>ÀÑHñ
ô 
ˆð	ð 	ð 	ð 	ð 	ð 	
�Š�eÑÔÐØˆr   c                 ó  ‡ — t          ¦   «         }‰                      |¦  «         ‰ j                             dt	          j        d¦  «        z   dz   ¦  «        }ˆ fd„}|                     ‰ j        ¦  «         |                     |¦  «         |S )zP
        Test that channel requests that fail send MSG_CHANNEL_FAILURE.
        r²   rÞ   r…   c                 ób   •— ‰                      ‰j        j        t          j        dfg¦  «         d S rà   )r‰   rg   ro   r
   ÚMSG_CHANNEL_FAILURErâ   s    €r   r‘   z;ConnectionTests.test_CHANNEL_REQUEST_failure.<locals>.checkD  rä   r   )	r   rt   rh   rå   r	   rˆ   r”   r–   r•   ræ   s   `   r   Útest_CHANNEL_REQUEST_failurez,ConnectionTests.test_CHANNEL_REQUEST_failure:  s–   ø€ õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒI×)Ò)Ø¥&¤)¨GÑ"4Ô"4Ñ4°wÑ>ñ
ô 
ˆð	ð 	ð 	ð 	ð 	ð 	
�Š�d”iÑ Ô Ð Ø	�Š�UÑÔÐØˆr   c                 óÆ   ‡ — t          ¦   «         }‰                      |¦  «         ‰ j                             |ddd¦  «        }‰ j                             d¦  «         ˆ fd„}|S )zj
        Test that channel request success messages cause the Deferred to be
        called back.
        rÞ   r-   Tr²   c                 ó2   •— ‰                      | ¦  «         d S re   )r}   râ   s    €r   r‘   z;ConnectionTests.test_CHANNEL_REQUEST_SUCCESS.<locals>.checkX  s   ø€ Ø�OŠO˜FÑ#Ô#Ð#Ð#Ð#r   )r   rt   rh   ÚsendRequestÚssh_CHANNEL_SUCCESSræ   s   `   r   Útest_CHANNEL_REQUEST_SUCCESSz,ConnectionTests.test_CHANNEL_REQUEST_SUCCESSN  st   ø€ õ
 ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒI×!Ò! '¨7°G¸TÑBÔBˆØŒ	×%Ò%Ð&9Ñ:Ô:Ð:ð	$ð 	$ð 	$ð 	$ð 	$ð ˆr   c                 ó$  ‡ — t          ¦   «         }‰                      |¦  «         ‰ j                             |ddd¦  «        }‰ j                             d¦  «         ˆ fd„}|                     ‰ j        ¦  «         |                     |¦  «         |S )zi
        Test that channel request failure messages cause the Deferred to be
        erred back.
        rÞ   r   Tr²   c                 óH   •— ‰                      | j        j        d¦  «         d S )Nzchannel request failed)r‰   rœ   râ   s    €r   r‘   z;ConnectionTests.test_CHANNEL_REQUEST_FAILURE.<locals>.checkg  s%   ø€ Ø×Ò˜Vœ\Ô/Ð1IÑJÔJÐJÐJÐJr   )r   rt   rh   rî   Ússh_CHANNEL_FAILUREr”   r–   r•   ræ   s   `   r   Útest_CHANNEL_REQUEST_FAILUREz,ConnectionTests.test_CHANNEL_REQUEST_FAILURE]  sŸ   ø€ õ
 ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒI×!Ò! '¨7°C¸Ñ>Ô>ˆØŒ	×%Ò%Ð&9Ñ:Ô:Ð:ð	Kð 	Kð 	Kð 	Kð 	Kð 	
�Š�d”iÑ Ô Ð Ø	�Š�UÑÔÐØˆr   c                 ó°  — | j                              ddd¦  «        }|                     d„ ¦  «         | j                              ddd¦  «         |                      | j        j        t          j        t          j	        d¦  «        dz   ft          j        t          j	        d¦  «        d	z   fg¦  «         |                      | j         j
        d
|gi¦  «         dS )zQ
        Test that global request messages are sent in the right format.
        s	   wantReplyr-   Tc                 ó   — d S re   r   ©Úfailures    r   ú<lambda>z8ConnectionTests.test_sendGlobalRequest.<locals>.<lambda>t  ó   €  T€ r   s   noReplyr   Fs   ÿdatar†   ÚglobalN)rh   r’   r•   r‰   rg   ro   r
   ÚMSG_GLOBAL_REQUESTr	   rˆ   Ú	deferreds©r   r˜   s     r   Útest_sendGlobalRequestz&ConnectionTests.test_sendGlobalRequestn  sÏ   € ð ŒI×'Ò'¨°g¸tÑDÔDˆà	�ŠÐ)Ð)Ñ*Ô*Ð*ØŒ	×#Ò# J°°UÑ;Ô;Ð;Ø×ÒØŒNÔ"åÔ.µ´	¸,Ñ0GÔ0GÈ+Ñ0UÐVÝÔ.µ´	¸*Ñ0EÔ0EÈÑ0OÐPðñ	
ô 	
ð 	
ð 	×Ò˜œÔ,¨x¸!¸¨oÑ>Ô>Ð>Ð>Ð>r   c                 óR  — t          ¦   «         }| j                             |d¦  «         |                      | j        j        t          j        t          j	        d¦  «        dz   fg¦  «         |                      |j
        d¦  «         |                      | j        j        d¦  «         dS )zO
        Test that open channel messages are sent in the right format.
        s   aaaar   s            € aaaar   r,   N)r   rh   rn   r‰   rg   ro   r
   ÚMSG_CHANNEL_OPENr	   rˆ   r   ÚlocalChannelIDrs   s     r   Útest_openChannelz ConnectionTests.test_openChannel  s¨   € õ ‘-”-ˆØŒ	×Ò˜g wÑ/Ô/Ð/Ø×ÒØŒNÔ"õ Ô/Ý”I˜nÑ-Ô-ØMñNððñ		
ô 		
ð 		
ð 	×Ò˜œ QÑ'Ô'Ð'Ø×Ò˜œÔ1°1Ñ5Ô5Ð5Ð5Ð5r   c           	      óV  — t          ¦   «         }|                      |¦  «         | j                             |ddd¦  «        }|                     d„ ¦  «         | j                             |ddd¦  «         d|_        | j                             |ddd¦  «         |                      | j        j        t          j
        dt          j        d¦  «        z   d	z   ft          j
        dt          j        d¦  «        z   d
z   fg¦  «         |                      | j        j        d         |g¦  «         dS )zR
        Test that channel request messages are sent in the right format.
        rÞ   Tc                 ó   — d S re   r   r÷   s    r   rù   z2ConnectionTests.test_sendRequest.<locals>.<lambda>š  rú   r   ó   test2r   Fs   test3rÊ   s   testr†   r   N)r   rt   rh   rî   r•   ÚlocalClosedr‰   rg   ro   r
   ÚMSG_CHANNEL_REQUESTr	   rˆ   rý   ©r   r   r˜   s      r   Útest_sendRequestz ConnectionTests.test_sendRequest’  s)  € õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒI×!Ò! '¨7°G¸TÑBÔBˆà	�ŠÐ)Ð)Ñ*Ô*Ð*ØŒ	×Ò˜g x°°eÑ<Ô<Ð<Ø"ˆÔØŒ	×Ò˜g x°°dÑ;Ô;Ð;Ø×ÒØŒNÔ"õ Ô2Ø'­&¬)°GÑ*<Ô*<Ñ<¸{ÑJðõ
 Ô2Ø'­&¬)°HÑ*=Ô*=Ñ=ÀÑGðð	ñ	
ô 	
ð 	
ð 	×Ò˜œÔ,¨QÔ/°!°Ñ5Ô5Ð5Ð5Ð5r   c                 óž  — t          d¬¦  «        }|                      |¦  «         d|_        | j                             |d¦  «         |                      |j        d¦  «         d|_        | j                             |d¦  «         |                      |j        d¦  «         |                      | j        j        t          j
        dfg¦  «         dS )	zi
        Test that channel window adjust messages cause bytes to be added
        to the window.
        rÄ   )rÆ   r   r,   Té   ó      ÿ   N)r   rt   rÍ   rh   ÚadjustWindowr‰   r  rg   ro   r
   rÌ   rs   s     r   Útest_adjustWindowz!ConnectionTests.test_adjustWindow­  sÙ   € õ
 ¨!Ð,Ñ,Ô,ˆØ×Ò˜'Ñ"Ô"Ð"Ø"#ˆÔØŒ	×Ò˜w¨Ñ*Ô*Ð*Ø×Ò˜Ô0°!Ñ4Ô4Ð4Ø"ˆÔØŒ	×Ò˜w¨Ñ*Ô*Ð*Ø×Ò˜Ô0°!Ñ4Ô4Ð4Ø×ÒØŒNÔ"õ Ô8Ø;ððñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óJ  — t          ¦   «         }|                      |¦  «         | j                             |d¦  «         d|_        | j                             |d¦  «         |                      | j        j        t          j	        dt          j        d¦  «        z   fg¦  «         dS )zO
        Test that channel data messages are sent in the right format.
        rÉ   Tó   brÊ   N)r   rt   rh   ÚsendDatar  r‰   rg   ro   r
   ÚMSG_CHANNEL_DATAr	   rˆ   rs   s     r   Útest_sendDatazConnectionTests.test_sendDataÄ  sŸ   € õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒ	×Ò˜7 DÑ)Ô)Ð)Ø"ˆÔØŒ	×Ò˜7 DÑ)Ô)Ð)Ø×ÒØŒNÔ"ÝÔ)Ð+>ÅÄÈ4ÁÄÑ+PÐQÐRñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óN  — t          ¦   «         }|                      |¦  «         | j                             |dd¦  «         d|_        | j                             |dd¦  «         |                      | j        j        t          j	        dt          j        d¦  «        z   fg¦  «         dS )zX
        Test that channel extended data messages are sent in the right format.
        r,   rÞ   Tr  r  r  N)r   rt   rh   ÚsendExtendedDatar  r‰   rg   ro   r
   ÚMSG_CHANNEL_EXTENDED_DATAr	   rˆ   rs   s     r   Útest_sendExtendedDataz%ConnectionTests.test_sendExtendedDataÒ  s«   € õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒ	×"Ò" 7¨A¨wÑ7Ô7Ð7Ø"ˆÔØŒ	×"Ò" 7¨A¨xÑ8Ô8Ð8Ø×ÒØŒNÔ"õ Ô8Ø=ÅÄ	È'Ñ@RÔ@RÑRððñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óv  — t          ¦   «         }|                      |¦  «         | j                             |¦  «         |                      | j        j        t          j        dfg¦  «         d|_	        | j                             |¦  «         |                      | j        j        t          j        dfg¦  «         dS )zN
        Test that channel EOF messages are sent in the right format.
        rÊ   TN)
r   rt   rh   ÚsendEOFr‰   rg   ro   r
   ÚMSG_CHANNEL_EOFr  rs   s     r   Útest_sendEOFzConnectionTests.test_sendEOFå  s½   € õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒ	×Ò˜'Ñ"Ô"Ð"Ø×ÒØŒNÔ"¥jÔ&@ÐBUÐ%VÐ$Wñ	
ô 	
ð 	
ð #ˆÔØŒ	×Ò˜'Ñ"Ô"Ð"Ø×ÒØŒNÔ"¥jÔ&@ÐBUÐ%VÐ$Wñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óÀ  — t          ¦   «         }|                      |¦  «         | j                             |¦  «         |                      |j        ¦  «         |                      | j        j        t          j
        dfg¦  «         | j                             |¦  «         |                      | j        j        t          j
        dfg¦  «         t          ¦   «         }|                      |¦  «         |                      |j        ¦  «         |                      |j        ¦  «         d|_        | j                             |¦  «         |                      |j        ¦  «         dS )zP
        Test that channel close messages are sent in the right format.
        rÊ   TN)r   rt   rh   rÚ   r}   r  r‰   rg   ro   r
   rÎ   r   r~   r%   ÚremoteClosed)r   r   r‚   s      r   Útest_sendClosezConnectionTests.test_sendCloseõ  sF  € õ ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"ØŒ	×Ò˜GÑ$Ô$Ð$Ø�Š˜Ô+Ñ,Ô,Ð,Ø×ÒØŒNÔ"ÝÔ*Ð,?Ð@ÐAñ	
ô 	
ð 	
ð 	Œ	×Ò˜GÑ$Ô$Ð$Ø×ÒØŒNÔ"ÝÔ*Ð,?Ð@ÐAñ	
ô 	
ð 	
õ
 ‘=”=ˆØ×Ò˜(Ñ#Ô#Ð#Ø�Š˜Ô(Ñ)Ô)Ð)Ø×Ò˜Ô+Ñ,Ô,Ð,Ø $ˆÔØŒ	×Ò˜HÑ%Ô%Ð%Ø�Š˜Ô*Ñ+Ô+Ð+Ð+Ð+r   c                 ó>  — | j                              dddd¦  «        }|                      |j        d¦  «         |                      |j        d¦  «         |                      |j        d¦  «         |                      t          j        | j         j        dddd¦  «         dS )z³
        Test that getChannel dispatches to the avatar when an avatar is
        present. Correct functioning without the avatar is verified in
        test_CHANNEL_OPEN.
        r   é2   é   r-   r£   N)	rh   Ú
getChannelr‰   r/   r¥   rD   ÚassertRaisesr   rH   rs   s     r   Útest_getChannelWithAvatarz)ConnectionTests.test_getChannelWithAvatar  s    € ð ”)×&Ò& ~°r¸2¸wÑGÔGˆØ×Ò˜œ wÑ/Ô/Ð/Ø×Ò˜Ô1°2Ñ6Ô6Ð6Ø×Ò˜Ô0°"Ñ5Ô5Ð5Ø×ÒÝÔ˜dœiÔ2°MÀ2ÀrÈ7ñ	
ô 	
ð 	
ð 	
ð 	
r   c                 ó*  — | j         `|                      | j                             dd¦  «        ¦  «         |                      | j                             dd¦  «        d¦  «         |                      | j                             dd¦  «        ¦  «         dS )zW
        Test that gotGlobalRequests dispatches to global_* without an avatar.
        rO   r-   s	   Test-Data)Tr-   s	   BadGlobalN)rg   rE   r}   rh   rR   r‰   r~   r   s    r   Ú"test_gotGlobalRequestWithoutAvatarz2ConnectionTests.test_gotGlobalRequestWithoutAvatar  s�   € ð ŒNÐ!Ø�Š˜œ	×2Ò2°=À'ÑJÔJÑKÔKÐKØ×ÒØŒI×&Ò& |°WÑ=Ô=¸ñ	
ô 	
ð 	
ð 	×Ò˜œ×3Ò3°LÀ'ÑJÔJÑKÔKÐKÐKÐKr   c                 óü   — t          ¦   «         }|                      |¦  «         | j                             |ddd¬¦  «        }|                      |t
          j        ¦  «        }| j                             |¦  «         |S )z›
        Whenever an SSH channel gets closed any Deferred that was returned by a
        sendRequest() on its parent connection must be errbacked.
        ó   dummyrequestó	   dummydatar,   ©Ú	wantReply)r   rt   rh   rî   ÚassertFailurer   rH   ÚchannelClosedr	  s      r   Ú9test_channelClosedCausesLeftoverChannelDeferredsToErrbackzIConnectionTests.test_channelClosedCausesLeftoverChannelDeferredsToErrback(  ss   € õ
 ‘-”-ˆØ×Ò˜'Ñ"Ô"Ð"àŒI×!Ò! '¨?¸LÐTUÐ!ÑVÔVˆØ×Ò˜q¥%Ô"2Ñ3Ô3ˆØŒ	×Ò Ñ(Ô(Ð(Øˆr   N)&r   r   r   r   ra   rj   rt   rw   rz   rƒ   rŒ   r™   rŸ   r©   r®   r°   rµ   r½   rÁ   rÒ   rÕ   rØ   rÜ   rç   rë   rð   rô   rÿ   r  r
  r  r  r  r  r  r%  r'  r/  r   r   r   rc   rc   Í   s  € € € € € Øð 1Ø0ˆð#ð #ð #ð
ð 
ð 
ð#ð #ð #ð=ð =ð =ðJð Jð Jð*5ð 5ð 5ð0ð ð ðð ð ð2
ð 2
ð 2
ðh
ð 
ð 
ð8*ð *ð *ð?ð ?ð ?ð;ð ;ð ;ð	Fð 	Fð 	Fð#
ð #
ð #
ðJ)
ð )
ð )
ðV(ð (ð (ð+ð +ð +ð ð ð ð.ð ð ð(ð ð ðð ð ð"?ð ?ð ?ð"6ð 6ð 6ð&6ð 6ð 6ð6
ð 
ð 
ð.
ð 
ð 
ð
ð 
ð 
ð&
ð 
ð 
ð ,ð ,ð ,ð4
ð 
ð 
ð	Lð 	Lð 	Lðð ð ð ð r   rc   c                   ó&   — e Zd ZdZesdZd„ Zd„ ZdS )ÚCleanConnectionShutdownTestszL
    Check whether correct cleanup is performed on connection shutdown.
    rU   c                 ó°   — t          j        d ¦  «        | _        t          ¦   «         | j        _        t          ¦   «         | _        | j        | j        _        d S re   )r   rf   rg   r@   rE   rT   rh   r   s    r   rj   z"CleanConnectionShutdownTests.setUp>  sA   € Ý&Ô4°TÑ:Ô:ˆŒÝ *¡¤ˆŒÔÝ"Ñ$Ô$ˆŒ	Ø"œnˆŒ	ÔÐÐr   c                 óä   — | j                              ¦   «          | j                              ddd¬¦  «        }|                      |t          j        ¦  «        }| j                              ¦   «          |S )zŒ
        Once the service is stopped any leftover global deferred returned by
        a sendGlobalRequest() call must be errbacked.
        r)  r*  r,   r+  )rh   ri   r’   r-  r   rH   rv   rþ   s     r   Ú9test_serviceStoppedCausesLeftoverGlobalDeferredsToErrbackzVCleanConnectionShutdownTests.test_serviceStoppedCausesLeftoverGlobalDeferredsToErrbackD  sf   € ð
 	Œ	× Ò Ñ"Ô"Ð"àŒI×'Ò'¨¸ÐQRÐ'ÑSÔSˆØ×Ò˜q¥%Ô"2Ñ3Ô3ˆØŒ	× Ò Ñ"Ô"Ð"Øˆr   N)r   r   r   r=   r   ra   rj   r4  r   r   r   r1  r1  6  sK   € € € € € ðð ð ð 1Ø0ˆð-ð -ð -ð
ð 
ð 
ð 
ð 
r   r1  )r=   rq   Útwisted.conch.sshr   Útwisted.conch.testr   Útwisted.python.reflectr   Útwisted.trialr   r   Útwisted.conchr   r	   r
   Ú
SSHChannelr   r@   r   rT   ÚTestCaserc   r1  r   r   r   ú<module>r<     sÈ  ððð ð €€€à %Ð %Ð %Ð %Ð %Ð %Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø "Ð "Ð "Ð "Ð "Ð "àˆ}˜^Ñ,Ô,€à Ð Ð Ð Ð Ð àð Ø4Ð4Ð4Ð4Ð4Ð4Ð4Ð4Ð4ðð ð ð ð ñ ô ð ð
Yð Yð Yð Yð Y�'Ô$ñ Yô Yð Yðx&ð &ð &ð &ð &ñ &ô &ð &ðR).ð ).ð ).ð ).ð ).�ZÔ-ñ ).ô ).ð ).ðXf	ð f	ð f	ð f	ð f	�hÔ'ñ f	ô f	ð f	ðRð ð ð ð  8Ô#4ñ ô ð ð ð r   