HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/test_asyncio/__pycache__/test_sslproto.cpython-37.opt-2.pyc
B

��g�f�@sNddlZddlZddlZddlZddlZddlmZyddlZWnek
rXdZYnXddlZddlm	Z	ddlm
Z
ddlmZddlmZddl
mZddl
mZe�edkd	�Gd
d�dej��ZGdd
�d
ej�Ze�edkd	�Gdd�deej��Ze�edkd	�e�eed�d�Gdd�deej���Zedk�rJe��dS)�N)�mock)�log)�	protocols)�sslproto)�tasks)�utils)�
functionalz
No ssl modulecs�eZdZ�fdd�Zddd�dd�Zdd�dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Z�ZS)�SslProtoHandshakeTestscs$t���t��|_|�|j�dS)N)�super�setUp�asyncioZnew_event_loop�loopZset_event_loop)�self)�	__class__��;/usr/local/lib/python3.7/test/test_asyncio/test_sslproto.pyrs

zSslProtoHandshakeTests.setUpN)�waiter�protocCsRt��}|dkrt��}tj|j|||dd�}|�|j�	�|�|�
|jj�|S)Ng�������?)�ssl_handshake_timeout)�
test_utils�dummy_ssl_contextr�Protocolr�SSLProtocolr
�assertIs�_app_transport�get_protocolZ
addCleanup�close)rrr�
sslcontext�	ssl_protorrr�ssl_protocolsz#SslProtoHandshakeTests.ssl_protocol)�do_handshakec	Cs^t��}t��}d|j_|r&||j_ndd�}||j_tjd|d��|�|�WdQRX|S)N�cSsgS)Nr)�callbackrrr�mock_handshake0sz>SslProtoHandshakeTests.connection_made.<locals>.mock_handshakezasyncio.sslproto._SSLPipe)�return_value)r�Mock�shutdownr$r Zside_effectZpatch�connection_made)rrr �	transportZsslpiper#rrrr')s
z&SslProtoHandshakeTests.connection_madec	CsJt��}t��}t��}|�td��tj|j|||dd�WdQRXdS)Nza positive numberr)r)	rrrr%�assertRaisesRegex�
ValueErrorrrr
)rr�	app_protorrrr�test_handshake_timeout_zero7sz2SslProtoHandshakeTests.test_handshake_timeout_zeroc	CsJt��}t��}t��}|�td��tj|j|||dd�WdQRXdS)Nza positive numberi����)r)	rrrr%r)r*rrr
)rrr+rrrr�test_handshake_timeout_negative?sz6SslProtoHandshakeTests.test_handshake_timeout_negativecCsLtj|jd�}|j|d�}|�|�|��t�|j�|�|�	�t
�dS)N)r
)r)r�Futurer
rr'�eof_receivedr�run_briefly�assertIsInstance�	exception�ConnectionResetError)rrrrrr�test_eof_received_waiterGs
z/SslProtoHandshakeTests.test_eof_received_waiterc	CsTtj|jd�}|j|d�}tj��}tj�tj	�z|�
d�Wdtj�|�XdS)N)r
)r)rr.r
rrZloggerZgetEffectiveLevelZsetLevel�loggingZFATALZ_fatal_error)rrrZ	log_levelrrr�test_fatal_error_no_name_errorOs
z5SslProtoHandshakeTests.test_fatal_error_no_name_errorcCsNtj|jd�}|j|d�}|�|�|�t�t�|j�|�	|�
�t�dS)N)r
)r)rr.r
rr'�connection_lost�ConnectionAbortedErrorrr0r1r2)rrrrrr�test_connection_lost^s

z+SslProtoHandshakeTests.test_connection_lostcCsLtj|jd�}|j|d�}|�|�}t�|j�|j��|�	|j
j�dS)N)r
)r)rr.r
rr'rr0rr�
assertTrue�abortZcalled)rrrr(rrr�test_close_during_handshakehs

z2SslProtoHandshakeTests.test_close_during_handshakecCs|tj|jd�}|j|d�}|�|�d��t�}|�|�d|�|�|�|�|�	|�d��|�
d�|�|�d��dS)N)r
)r�socket)rr.r
r�assertIsNoneZ_get_extra_info�objectrr'ZassertIsNotNoner7)rrr�defaultrrr�(test_get_extra_info_on_closed_connectionss

z?SslProtoHandshakeTests.test_get_extra_info_on_closed_connectioncCsRtj|jd�}|j|d�}t��}|j�|�|�|j��|�|�|j	|�dS)N)r
)r)
rr.r
rrr�set_protocolrrZ
_app_protocol)rrrZ
new_app_protorrr�test_set_new_app_protocol~sz0SslProtoHandshakeTests.test_set_new_app_protocolcCs4|��}|�|�|j}|��|�|�d��dS)Nsdata)rr'rrr>�
data_received)rr�transprrr� test_data_received_after_closing�s

z7SslProtoHandshakeTests.test_data_received_after_closingcCs4|��}|�|�|j}|��|�|�d��dS)Nsdata)rr'rrr>�write)rrrErrr�test_write_after_closing�s

z/SslProtoHandshakeTests.test_write_after_closing)�__name__�
__module__�__qualname__rrr'r,r-r4r6r9r<rArCrFrH�
__classcell__rr)rrr	s


r	c@steZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�BaseStartTLSi��<cCst�dS)N)�NotImplementedError)rrrr�new_loop�szBaseStartTLS.new_loopc
CsGdd�dtj�}x�dD]�}|d|�}t�|d�|�|jd�|d|�}t�|d�|�|jd�|d|�}t�|d�|�|jd�|d|�}t�|d�|�|jd�|d	|�}t�|d�|�|jd�|d
|�}|�td��t�|d�WdQRXqWdS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z.BaseStartTLS.test_buf_feed_data.<locals>.ProtocSs&t|�|_t|j�|_d|_||_dS)Nr!)�	bytearray�buf�
memoryview�mv�data�usemv)r�bufsizerVrrr�__init__�s
z7BaseStartTLS.test_buf_feed_data.<locals>.Proto.__init__cSs|jr|jS|jSdS)N)rVrTrR)r�sizehintrrr�
get_buffer�sz9BaseStartTLS.test_buf_feed_data.<locals>.Proto.get_buffercSs<|jr |j|jd|�7_n|j|jd|�7_dS)N)rVrUrTrR)r�nsizerrr�buffer_updated�sz=BaseStartTLS.test_buf_feed_data.<locals>.Proto.buffer_updatedN)rIrJrKrXrZr\rrrr�Proto�sr])FT�s12345�s1234��drzempty buffer)r�BufferedProtocolrZ_feed_data_to_buffered_proto�assertEqualrUr)�RuntimeError)rr]rVrrrr�test_buf_feed_data�s(






zBaseStartTLS.test_buf_feed_datac	s�d�j�t���t������fdd�}G�fdd�dtj������fdd�}�j|�jd��&}�j�	tj
||j��jd	d
��WdQRXt�
��������dS)N�1cs�|��j�|�t���}��t|�t���|j�dd�|�d�|�t���}��t|�t���|�tj	�|�
�dS)NT)�server_side�O)�
settimeout�TIMEOUT�recv_all�lenrc�	start_tls�sendallr&r=�	SHUT_RDWRr)�sockrU)�	HELLO_MSGr�server_contextrr�serve�s
z=BaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.servecs0eZdZdd�Z�fdd�Zdd�Zdd�Zd	S)
zCBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProtocSs||_||_d|_dS)Nr)�on_data�on_eof�con_made_cnt)rrtrurrrrX�szLBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.__init__cs |jd7_��|jd�dS)Nr^)rvrc)r�tr)rrrr'�szSBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.connection_madecSs|j�|�dS)N)rt�
set_result)rrUrrrrD�szQBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.data_receivedcSs|j�d�dS)NT)rurx)rrrrr/�szPBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.eof_receivedN)rIrJrKrXr'rDr/r)rrr�ClientProto�sryc�s�tjd�jd�IdH�j����j����jj���fdd�f|��IdH\}}|����j�||��IdH}���IdHd�|����IdH|��dS)Ng�?)r
cs
����S)Nrr)ryrtrurr�<lambda>r!zPBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.client.<locals>.<lambda>rh)	r�sleepr
�
create_future�create_connectionrGrmrcr)�addrrwr�new_tr)ryrq�client_contextr)rtrur�client�s

"


z>BaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.client)�timeout�
)r
r�)�PAYLOAD_SIZEr�simple_server_sslcontext�simple_client_sslcontextrr�
tcp_serverrjr
�run_until_complete�wait_forr~�weakref�refr>)rrsr��srvr)ryrqr�rrrr�!test_start_tls_client_reg_proto_1�s
$
z.BaseStartTLS.test_start_tls_client_reg_proto_1c	s�d�j�t���t������fdd�}G�fdd�dtj������fdd�}�j|�jd��"}�j�	tj
||j�d	d��WdQRXt�
��������dS)
Nrfcs^|��j�|j�dd�|�d�|�t���}��t|�t���|�tj	�|�
�dS)NT)rgrh)rirjrmrnrkrlrcr&r=ror)rprU)rqrrrrrrss
z>BaseStartTLS.test_create_connection_memory_leak.<locals>.servecs0eZdZdd�Z�fdd�Zdd�Zdd�Zd	S)
zDBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProtocSs||_||_d|_dS)Nr)rtrurv)rrtrurrrrX)szMBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.__init__cs&||_|jd7_��|jd�dS)Nr^)rwrvrc)rrw)rrrr'.szTBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.connection_madecSs|j�|�dS)N)rtrx)rrUrrrrD5szRBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.data_receivedcSs|j�d�dS)NT)rurx)rrrrr/8szQBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.eof_receivedN)rIrJrKrXr'rDr/r)rrrry(sryc�s�t�d�IdH�j����j����jj���fdd�f|�d�i�IdH\}}���IdHd�|����IdH|��dS)Ng�?cs
����S)Nrr)ryrtrurrrzBr!zQBaseStartTLS.test_create_connection_memory_leak.<locals>.client.<locals>.<lambda>�sslrh)rr{r
r|r}rcrGr)r~rwr)ryrqr�r)rtrurr�;s



z?BaseStartTLS.test_create_connection_memory_leak.<locals>.client)r�r�)r�rr�r�rrr�rjr
r�r�r~r�r�r>)rrsr�r�r)ryrqr�rrrr�"test_create_connection_memory_leaks
 
z/BaseStartTLS.test_create_connection_memory_leakc	s�d�j�t���t���d����fdd�}G�fdd�dtj��G�fdd�dtj��������fd	d
�}�j|�jd��(}�j	�
tj||j��j	�jd��WdQRXdS)
Nrfrcs�|��j�|�t���}��t|�t���|j�dd�|�d�|�t���}��t|�t���|�d�|�t���}��t|�t���|�tj	�|�
�dS)NT)rgrh�2)rirjrkrlrcrmrnr&r=ror)rprU)rqrrrrrrs[s

z=BaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.servecs0eZdZdd�Z�fdd�Zdd�Zdd�Zd	S)
zHBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirstcSs||_td�|_dS)Nr^)rtrQrR)rrtrrrrXoszQBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.__init__cs�d7�dS)Nr^r)rrw)�client_con_made_callsrrr'sszXBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.connection_madecSs|jS)N)rR)rrYrrrrZwszSBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.get_buffercSs|j�t|jd|���dS)N)rtrx�bytesrR)rr[rrrr\zszWBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.buffer_updatedN)rIrJrKrXr'rZr\r)r�rr�ClientProtoFirstnsr�cs0eZdZdd�Z�fdd�Zdd�Zdd�Zd	S)
zIBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecondcSs||_||_d|_dS)Nr)rtrurv)rrtrurrrrXszRBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.__init__cs�d7�dS)Nr^r)rrw)r�rrr'�szYBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.connection_madecSs|j�|�dS)N)rtrx)rrUrrrrD�szWBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.data_receivedcSs|j�d�dS)NT)rurx)rrrrr/�szVBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.eof_receivedN)rIrJrKrXr'rDr/r)r�rr�ClientProtoSecond~sr�c�s�tjd�jd�IdH�j����j��}�j��}�jj��fdd�f|��IdH\}}|����j�||��IdH}���IdHd�|���|��||����|IdHd�|���|IdH|�	����d�dS)Ng�?)r
cs���S)Nrr)r��on_data1rrrz�r!zPBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.client.<locals>.<lambda>rhr�r^)
rr{r
r|r}rGrmrcrBr)r~Zon_data2rurwrr)r�r�rqr�r�r)r�rr��s 


 



z>BaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.client)r�)r
r�)
r�rr�r�rrbrr�rjr
r�r�r~)rrsr�r�r)r�r�rqr�r�rrrr�!test_start_tls_client_buf_proto_1Ts
z.BaseStartTLS.test_start_tls_client_buf_proto_1c	s�d�j�t����j������fdd�}G�fdd�dtj�������fdd�}�j|�jd��&}�j�	tj
||j��jd	d
��WdQRXdS)Nrfcsv|��j�|�t���}��t|�t���z8y�j��jd�|�d�}Wntk
rbYnXWd|�	�XdS)Ni)
rirjrkrlrcr
Zcall_soon_threadsaferxr8r)rprU)rqr�server_waits_on_handshakerrrs�s

z=BaseStartTLS.test_start_tls_slow_client_cancel.<locals>.servecs0eZdZdd�Z�fdd�Zdd�Zdd�Zd	S)
zCBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProtocSs||_||_d|_dS)Nr)rtrurv)rrtrurrrrX�szLBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.__init__cs |jd7_��|jd�dS)Nr^)rvrc)rrw)rrrr'�szSBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.connection_madecSs|j�|�dS)N)rtrx)rrUrrrrD�szQBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.data_receivedcSs|j�d�dS)NT)rurx)rrrrr/�szPBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.eof_receivedN)rIrJrKrXr'rDr/r)rrrry�sryc	�s�tjd�jd�IdH�j����j����jj���fdd�f|��IdH\}}|����IdH��tj��*tj�j�	||��d�jd�IdHWdQRXdS)Ng�?)r
cs
����S)Nrr)ryrtrurrrz�r!zPBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.client.<locals>.<lambda>)
rr{r
r|r}rG�assertRaises�TimeoutErrorr�rm)r~rwr)ryrqr�rr�)rtrurr��s

"

z>BaseStartTLS.test_start_tls_slow_client_cancel.<locals>.client)r�r�)r
r�)r�rr�r
r|rrr�rjr�r�r~)rrsr�r�r)ryrqr�rr�r�!test_start_tls_slow_client_cancel�s

z.BaseStartTLS.test_start_tls_slow_client_cancelcs�d�j�d�t���t���d������fdd��G�fdd�dtj������fdd��������fd	d
�}�j�|��dS)Nrfsanswercsf|��j�|�|�|�t���}��t|�t���|���|���|�t����|��dS)N)	rirjZconnectrkrlrcrmrnr)rpr~rU)�ANSWERrq�answerr�rrrr��s


z4BaseStartTLS.test_start_tls_server_1.<locals>.clientcs8eZdZdd�Zdd�Zdd�Z�fdd�Zd	d
�ZdS)z9BaseStartTLS.test_start_tls_server_1.<locals>.ServerProtocSs"||_||_||_d|_d|_dS)Nr!)�on_con�on_con_lost�on_got_hellorUr()rr�r�r�rrrrXs
zBBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.__init__cSs||_|j�|�dS)N)r(r�rx)rrwrrrr'	szIBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.connection_madecSs
||_dS)N)r()rrwrrr�replace_transport
szKBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.replace_transportcs0|j|7_t|j�t��kr,|j�d�dS)N)rUrlr�rx)rrU)rqrrrDszGBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.data_receivedcSs,d|_|dkr|j�d�n|j�|�dS)N)r(r�rxZ
set_exception)r�excrrrr7szIBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.connection_lostN)rIrJrKrXr'r�rDr7r)rqrr�ServerProtos
r�c�s�|IdH}|�����|jd��jj||�d�jd�IdH}|�|�|IdH|���|IdH��|j��|��dS)Nr!T)rgr)rGrcrUr
rmrjr�r)rr�r�r�rwr)r�rqrrrrr�mains





z2BaseStartTLS.test_start_tls_server_1.<locals>.mainc	�s��j��}�j��}�j��}�|||���j��fdd�dd�IdH}|jd����j��fdd��jd��*tj��|||��j�jd�IdHWdQRX|�	�|�
�IdH�����dS)Ncs�S)Nrr)rrrrz6r!zHBaseStartTLS.test_start_tls_server_1.<locals>.run_main.<locals>.<lambda>z	127.0.0.1rcs
�|��S)Nr)rp)r~r�rrrz9r!)r�)r
r�)r
r|Z
create_serverZsocketsZgetsocknameZ
tcp_clientrjrr�rZwait_closedrc)r�r�r��server)r�r�r�r�r�r)r~rr�run_main/s


z6BaseStartTLS.test_start_tls_server_1.<locals>.run_main)r�rr�r�rrr
r�)rr�r)	r�rqr�r�r�r�r�rrrr�test_start_tls_server_1�s

z$BaseStartTLS.test_start_tls_server_1cs�fdd�}�j�|��dS)Nc	�sh��td���j�ddd�IdHWdQRXt��}��td���j�dd|�IdHWdQRXdS)NzSSLContext, gotzis not supported)r)�	TypeErrorr
rmrr�)�sslctx)rrrr�Fs
 z4BaseStartTLS.test_start_tls_wrong_args.<locals>.main)r
r�)rr�r)rr�test_start_tls_wrong_argsEsz&BaseStartTLS.test_start_tls_wrong_argsc
s�t���g��j��fdd��d��fdd�}��fdd�}�j|ddd	��0}��tj���j�||j	��WdQRXWdQRX��
�����g�t�
��������dS)
Ncs
��|�S)N)�append)r
�ctx)�messagesrrrzVr!z5BaseStartTLS.test_handshake_timeout.<locals>.<lambda>Fcs<z,y|�d�Wntk
r(d�YnXWd|��XdS)NiT)rkr8r)rp)�server_side_abortedrrr�Zs
z3BaseStartTLS.test_handshake_timeout.<locals>.serverc�s6tj�jjtjf|��ddd��d�jd�IdHdS)N�g$@)r��server_hostnamerg�?)r
)rr�r
r}r)r~)�
client_sslctxrrrr�csz3BaseStartTLS.test_handshake_timeout.<locals>.clientr^)�max_clients�backlog)rr�r
�set_exception_handlerr�r�rr�r�r~r:rcr�r�r>)rr�r�r�r)r�r�rr�r�test_handshake_timeoutPs	
&

z#BaseStartTLS.test_handshake_timeoutc
s�t���g��j��fdd��dd�}��fdd�}�j|ddd��0}��td	���j�||j��WdQRXWdQRX��	�g�dS)
Ncs
��|�S)N)r�)r
r�)r�rrrz�r!zHBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.<lambda>cSs8z(y|�d�Wntk
r$YnXWd|��XdS)Ni)rkr8r)rprrrr��s

zFBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.serverc�s&tj|�d�jdd��IdH\}}dS)Nr�g�?)r�r�r
r)r�open_connectionr
)r~�reader�writer)r�rrrr��szFBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.clientr^)r�r�zSSL handshake.*is taking longer)
rr�r
r�r�r)r8r�r~rc)rr�r�r�r)r�r�rr�)test_create_connection_ssl_slow_handshake�s
&z6BaseStartTLS.test_create_connection_ssl_slow_handshakec
s��j�dd��t���tjdd���fdd�}��fdd�}�j|d	d	d
��0}��tj���j�	||j
��WdQRXWdQRXdS)NcSsdS)Nr)r
r�rrrrz�r!zLBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.<lambda>F)Zdisable_verifycsPz@y|j�dd�Wn(tjk
r*Yntk
r<YnXWd|��XdS)NT)rg)rmr��SSLError�OSErrorr)rp)r�rrr��s
zJBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.serverc�s&tj|�d�jdd��IdH\}}dS)Nr�g�?)r�r�r
r)rr�r
)r~r�r�)r�rrrr��szJBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.clientr^)r�r�)r
r�rr�r�r�r�r�ZSSLCertVerificationErrorr�r~)rr�r�r�r)r�rr�r�-test_create_connection_ssl_failed_certificate�s
z:BaseStartTLS.test_create_connection_ssl_failed_certificatec	sx�j�dd��t���t����fdd�}��fdd�}�j|ddd��}�j�||j��}WdQRX��|d	�dS)
NcSsdS)Nr)r
r�rrrrz�r!zBBaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.<lambda>csl|��}zLy0|j�dd�|�d�|�d�|�d�Wntjk
rPYnXWd|��|��XdS)NT)rgsA
r^s!please corrupt the SSL connection)�duprmrnrk�sendr�r�r)rpZ	orig_sock)r�rrr��s


z@BaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.serverc	�srtj|�d�jd��IdH\}}��|��IdHd�|�d���tj��|��IdHWdQRX|�	�dS)Nr�)r�r�r
sA
�B�OK)
rr�r
rc�readlinerGr�r�r�r)r~r�r�)r�rrrr��s
z@BaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.clientr^)r�r�r�)	r
r�rr�r�r�r�r~rc)rr�r�r�Zresr)r�rr�r�#test_start_tls_client_corrupted_ssl�s
z0BaseStartTLS.test_start_tls_client_corrupted_sslN)rIrJrKr�rjrPrer�r�r�r�r�r�r�r�r�r�rrrrrM�s/@>[=Y0""rMc@seZdZdd�ZdS)�SelectorStartTLSTestscCst��S)N)rZSelectorEventLoop)rrrrrP�szSelectorStartTLSTests.new_loopN)rIrJrKrPrrrrr��sr��ProactorEventLoopzWindows onlyc@seZdZdd�ZdS)�ProactorStartTLSTestscCst��S)N)rr�)rrrrrP�szProactorStartTLSTests.new_loopN)rIrJrKrPrrrrr��sr��__main__)r5r=�sysZunittestr�rr��ImportErrorrrrrrZtest.test_asynciorrrZ
func_testsZskipIfZTestCaser	ZFunctionalTestCaseMixinrMr�Z
skipUnless�hasattrr�rIr�rrrr�<module>s>

V