Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_asyncio/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_asyncio/__pycache__/test_sslproto.cpython-312.opt-2.pyc

�

(Μg�j��^�	ddlZddlZddlZddlZddlmZddlmZddlmZ	ddl	Z	ddlZddlmZddlm
Z
ddlmZddlmZdd	lmZd
�Zej*e	dud�Gd�d
ej,��ZGd�dej0�Zej*e	dud�Gd�deej,��Zej*e	dud�ej6eed�d�Gd�deej,���Zedk(rej>�yy#e
$rdZ	Y��wxYw)�N)�support)�
socket_helper)�mock)�log)�	protocols)�sslproto)�utils)�
functionalc�.�tjd�y�N)�asyncio�set_event_loop_policy���</usr/local/lib/python3.12/test/test_asyncio/test_sslproto.py�tearDownModulers���!�!�$�'rz
No ssl modulec�z��eZdZ�fd�Zddd�d�Zdd�d�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Z�xZS)�SslProtoHandshakeTestsc���t�|��tj�|_|j|j�yr)�super�setUpr
�new_event_loop�loop�set_event_loop)�self�	__class__s �rrzSslProtoHandshakeTests.setUps.���
��
���*�*�,��	����D�I�I�&rN)�waiter�protoc�@�tj�}|�tj�}t	j
|j|||d��}|j|jj�|�|j|jj�|S)Ng�������?��ssl_handshake_timeout)�
test_utils�dummy_ssl_contextr
�Protocolr�SSLProtocolr�assertIs�_app_transport�get_protocol�
addCleanup�close)rrr�
sslcontext�	ssl_protos     r�ssl_protocolz#SslProtoHandshakeTests.ssl_protocol#s~���1�1�3�
��=��$�$�&�E��(�(����E�:�v�?B�D�	��
�
�i�.�.�;�;�=�u�E����	�0�0�6�6�7��r��do_handshakec��tj�}tj�}tj|j_tj|j_|�||_||_|j|�|Sr)
r�Mock�ssl�SSLWantReadError�read�side_effect�writer/�_sslobj�connection_made)rr,r/�	transport�sslobjs     rr8z&SslProtoHandshakeTests.connection_made-sf���I�I�K�	������"%�"6�"6�����#&�#7�#7���� ��#�".�F��"�	���!�!�)�,��rc��tj�}tj�}tj�}|j	t
d�5t
j|j|||d��ddd�y#1swYyxYw)N�a positive numberrr �	r"r#rr1�assertRaisesRegex�
ValueErrorrr%r�rr+�	app_protors    r�test_handshake_timeout_zeroz2SslProtoHandshakeTests.test_handshake_timeout_zero9sa���1�1�3�
��I�I�K�	������
�
#�
#�J�0C�
D�� � ����I�z�6�78�
:�E�
D�
D���%B�B
c��tj�}tj�}tj�}|j	t
d�5t
j|j|||d��ddd�y#1swYyxYw)Nr<i����r r=r@s    r�test_handshake_timeout_negativez6SslProtoHandshakeTests.test_handshake_timeout_negativeAsa���1�1�3�
��I�I�K�	������
�
#�
#�J�0C�
D�� � ����I�z�6�7:�
<�E�
D�
D�rCc�l�|jj�}|j|��}|j|t	j
tj����|j�tj|j�|j|j�t�y�N�r)r5r.)r�
create_futurer-r8rr1r2r3�eof_receivedr"�run_briefly�assertIsInstance�	exception�ConnectionResetError�rrr,s   r�test_eof_received_waiterz/SslProtoHandshakeTests.test_eof_received_waiterIs������(�(�*���%�%�V�%�4�	��������s�/C�/C�D�	�	
�	��� ����t�y�y�)����f�.�.�0�2F�Grc��|jj�}|j|��}tjj�}tjj
tj�	|jd�tjj
|�y#tjj
|�wxYw�NrH)
rrIr-r�logger�getEffectiveLevel�setLevel�logging�FATAL�_fatal_error)rrr,�	log_levels    r�test_fatal_error_no_name_errorz5SslProtoHandshakeTests.test_fatal_error_no_name_errorTs������(�(�*���%�%�V�%�4�	��J�J�0�0�2�	��
�
���G�M�M�*�	+��"�"�4�(�
�J�J���	�*��C�J�J���	�*�s�9B*�*!Cc�v�|jj�}|j|��}|j|t	j
tj����|jt�tj|j�|j|j�t�yrG)rrIr-r8rr1r2r3�connection_lost�ConnectionAbortedErrorr"rKrLrMrOs   r�test_connection_lostz+SslProtoHandshakeTests.test_connection_lostcs������(�(�*���%�%�V�%�4�	��������s�/C�/C�D�	�	
�	�!�!�"8�9����t�y�y�)����f�.�.�0�2H�Irc��|jj�}|j|��}|j|t	j
tj����}tj|j�|jj�|j|jj�yrG)rrIr-r8rr1r2r3r"rKr'r*�
assertTrue�_force_close�called)rrr,r9s    r�test_close_during_handshakez2SslProtoHandshakeTests.test_close_during_handshakeps������(�(�*���%�%�V�%�4�	��(�(�����s�/C�/C�D�)�
�	�	���t�y�y�)�� � �&�&�(����	�.�.�5�5�6rc���|j|j���}|j|�g�|jj�fd��|jj�|j
�g�y)N�rc�&���j|�Sr��append�r�ctx�messagess  �r�<lambda>zGSslProtoHandshakeTests.test_close_during_ssl_over_ssl.<locals>.<lambda>�����(�/�/�#�:Nr)r-r8r�set_exception_handlerr'r*�assertEqual)r�outerrks  @r�test_close_during_ssl_over_sslz5SslProtoHandshakeTests.test_close_during_ssl_over_ssl~si����!�!��(9�(9�(;�!�<�����U�#����	�	�'�'�(N�O�
���"�"�$�����2�&rc��|jj�}|j|��}|j|j	d��t�}|j
|j	d|�|�|j|�|j|j	d��|jd�|j|j	d��y)NrH�socket)
rrIr-�assertIsNone�_get_extra_info�objectr&r8�assertIsNotNoner\)rrr,�defaults    r�(test_get_extra_info_on_closed_connectionz?SslProtoHandshakeTests.test_get_extra_info_on_closed_connection�s������(�(�*���%�%�V�%�4�	����)�3�3�H�=�>��(���
�
�i�/�/��'�B�G�L����Y�'����Y�6�6�x�@�A��!�!�$�'����)�3�3�H�=�>rc�F�|jj�}|j|��}tj�}|j
j
|�|j|j
j�|�|j|j|�yrR)
rrIr-r
r$r'�set_protocolr&r(�
_app_protocol)rrr,�
new_app_protos    r�test_set_new_app_protocolz0SslProtoHandshakeTests.test_set_new_app_protocol�sz�����(�(�*���%�%�V�%�4�	��(�(�*�
�� � �-�-�m�<��
�
�i�.�.�;�;�=�}�M��
�
�i�-�-�}�=rc��|j�}|j|�|j}|j�|j	|jd��y)N�)r-r8r'r*rt�buffer_updated�rr,�transps   r� test_data_received_after_closingz7SslProtoHandshakeTests.test_data_received_after_closing�sM���%�%�'�	����Y�'��)�)������	
���)�2�2�1�5�6rc��|j�}|j|�|j}|j�|j	|jd��y)Nsdata)r-r8r'r*rtr6r�s   r�test_write_after_closingz/SslProtoHandshakeTests.test_write_after_closing�sK���%�%�'�	����Y�'��)�)������	
���&�,�,�w�/�0r)�__name__�
__module__�__qualname__rr-r8rBrErPrZr^rcrqryr~r�r��
__classcell__)rs@rrrsW���'�
&*���:>�
�:�<�	H�
+�J�7�
'�	?�>�7�1rrc��eZdZdZej
Zd�Zd�Zd�Z	d�Z
ejd��Z
d�Zejd��Zd	�Zd
�Zd�Zd�Zd
�Zy)�BaseStartTLSi�c��t�r)�NotImplementedError�rs r�new_loopzBaseStartTLS.new_loop�s��!�!rc�,�Gd�dtj�}dD�]h}|d|�}tj|d�|j	|j
d�|d|�}tj|d�|j	|j
d�|d|�}tj|d�|j	|j
d�|d|�}tj|d�|j	|j
d�|d	|�}tj|d�|j	|j
d�|d
|�}|j
td�5tj|d�ddd���ky#1swY��wxYw)Nc��eZdZd�Zd�Zd�Zy)�.BaseStartTLS.test_buf_feed_data.<locals>.Protoc�t�t|�|_t|j�|_d|_||_y�Nr)�	bytearray�buf�
memoryview�mv�data�usemv)r�bufsizer�s   r�__init__z7BaseStartTLS.test_buf_feed_data.<locals>.Proto.__init__�s,��$�W�-���$�T�X�X�.�����	�"��
rc�J�|jr|jS|jSr)r�r�r��r�sizehints  r�
get_bufferz9BaseStartTLS.test_buf_feed_data.<locals>.Proto.get_buffer�s���:�:��7�7�N��8�8�Orc��|jr#|xj|jd|z
c_y|xj|jd|z
c_yr)r�r�r�r�)r�nsizes  rr�z=BaseStartTLS.test_buf_feed_data.<locals>.Proto.buffer_updated�s:���:�:��I�I�����%��0�I��I�I����&�5�!1�1�IrN)r�r�r�r�r�r�rrr�Protor��s��
#�
$�
2rr�)FT�s12345�s1234��drzempty buffer)r
�BufferedProtocolr�_feed_data_to_buffered_protoror�r>�RuntimeError)rr�r�rs    r�test_buf_feed_datazBaseStartTLS.test_buf_feed_data�sJ��	2�G�,�,�	2�(#�E��!�U�O�E��2�2�5�(�C����U�Z�Z��2��!�U�O�E��2�2�5�(�C����U�Z�Z��2��!�U�O�E��2�2�5�'�B����U�Z�Z��1��!�U�O�E��2�2�5�'�B����U�Z�Z��1��#�u�%�E��2�2�5�(�C����U�Z�Z��2��!�U�O�E��'�'��n�E��6�6�u�h�G�F�E�-#�,F�E�s�&F	�	F	c�N������d�jz�tj��tj�����fd�}G�fd�dtj
������fd�}�j
|�j��5}�jjt	j||j�tj���ddd�tj���tj ��j#���y#1swY�IxYw)N�1c����|j�j�|jt���}�j	t|�t���|j�d��|j
d�|jt���}�j	t|�t���|jtj�|j�y�NT��server_side�O��
settimeout�TIMEOUT�recv_all�lenro�	start_tls�sendall�shutdownrs�	SHUT_RDWRr*��sockr��	HELLO_MSGr�server_contexts  ���r�servez=BaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.serve�s�����O�O�D�L�L�)��=�=��Y��0�D����S��Y��I��7��N�N�>�t�N�<��L�L����=�=��Y��0�D����S��Y��I��7��M�M�&�*�*�+��J�J�Lrc�*��eZdZd�Z�fd�Zd�Zd�Zy)�CBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProtoc�.�||_||_d|_y�Nr��on_data�on_eof�con_made_cnt�rr�r�s   rr�zLBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.__init__���&���$���$%��!rc�h��|xjdz
c_�j|jd�y�Nr��r�ro�r�trrs  �rr8zSBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.connection_made�*����"�"�a�'�"�� � ��!3�!3�Q�7rc�:�|jj|�yr�r��
set_result�rr�s  r�
data_receivedzQBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.data_received
������'�'��-rc�:�|jjd�y�NT�r�r�r�s rrJzPBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.eof_received������&�&�t�,rN�r�r�r�r�r8r�rJr�s�r�ClientProtor�����
&�

8�

.�
-rr�c�����K�tjd��d{����	jj���	jj���	jj���fd�g|����d{���\}}|j���	jj
||���d{���}�	j��d{���d�|j����d{���|j�y7��7��7�N7�;7��w)N��?c�������Srr�r�r�r�s���rrlzPBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.client.<locals>.<lambda>�����G�V�4rr�)	r
�sleeprrI�create_connectionr6r�ror*)
�addrr�r�new_trr�r�r�r��client_contextrs
    @@����r�clientz>BaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.clients�������-�-��$�$�$��i�i�-�-�/�G��Y�Y�,�,�.�F�9�d�i�i�9�9�4�=�7;�=�=�I�B��
�H�H�Y���9�9�.�.�r�5�.�I�I�F����7�]�D�1��L�L��#��L�L��L�L�N�
%��
=��J��*���sX�D
�D�AD
�<D�=8D
�5D�6D
�
D�D
�*D�+D
�D
�D
�D
�D
��timeout��PAYLOAD_SIZEr"�simple_server_sslcontext�simple_client_sslcontextr
r$�
tcp_serverr�r�run_until_complete�wait_forr�r�
SHORT_TIMEOUT�weakref�ref�
gc_collectrt�rr�r��srvr�r�r�r�s`   @@@@r�!test_start_tls_client_reg_proto_1z.BaseStartTLS.test_start_tls_client_reg_proto_1�s�����4�,�,�,�	�#�<�<�>��#�<�<�>��
	�	-�'�*�*�	-�"	�$�_�_�U�D�L�L�_�
9�S��I�I�(�(�� � �����!1�)0�)>�)>�@�
A�:�!���^�4���������.�*�+�:�
9��
�AD�D$c�N������d�jz�tj��tj�����fd�}G�fd�dtj
������fd�}�j
|�j��5}�jjt	j||j�tj���ddd�tj���tj ��j#���y#1swY�IxYw)Nr�c�^��|j�j�|j�d��|jd�|j	t���}�j
t|�t���|jtj�|j�yr�)r�r�r�r�r�r�ror�rsr�r*r�s  ���rr�z>BaseStartTLS.test_create_connection_memory_leak.<locals>.serve5st����O�O�D�L�L�)��N�N�>�t�N�<��L�L����=�=��Y��0�D����S��Y��I��7��M�M�&�*�*�+��J�J�Lrc�*��eZdZd�Z�fd�Zd�Zd�Zy)�DBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProtoc�.�||_||_d|_yr�r�r�s   rr�zMBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.__init__Br�rc�v��||_|xjdz
c_�j|jd�yr�)r�r�ror�s  �rr8zTBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.connection_madeGs1�������"�"�a�'�"�� � ��!3�!3�Q�7rc�:�|jj|�yrr�r�s  rr�zRBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.data_receivedNr�rc�:�|jjd�yr�r�r�s rrJzQBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.eof_receivedQr�rNr�r�s�rr�r�As���
&�

8�
.�
-rr�c�����K�tjd��d{����jj���jj���jj���fd�g|��d�i��d{���\}}�j��d{���d�|j
����d{���|j�y7��7�O7�97��w)Nr�c�������Srrr�s���rrlzQBaseStartTLS.test_create_connection_memory_leak.<locals>.client.<locals>.<lambda>[r�rr2r�)r
r�rrIr�ror6r*)	r�r�rr�r�r�r�r�rs	   @@����rr�z?BaseStartTLS.test_create_connection_memory_leak.<locals>.clientTs�������-�-��$�$�$��i�i�-�-�/�G��Y�Y�,�,�.�F�9�d�i�i�9�9�4�$�7;�$�"�$�$�I�B��
���7�]�D�1��H�H�Y���L�L��H�H�J�
%��
$��+���sF�C�C
�A C�?C�C�C�C�7C�8C�C�C�Cr�r�r�s`   @@@@r�"test_create_connection_memory_leakz/BaseStartTLS.test_create_connection_memory_leak/s�����4�,�,�,�	�#�<�<�>��#�<�<�>��
	�	-�'�*�*�	-�&	� �_�_�U�D�L�L�_�
9�S��I�I�(�(�� � �����!1�)0�)>�)>�@�
A�:�!���^�4���������.�*�+�:�
9�r�c��������	�d�jz�tj��	tj��d����	fd�}G��fd�dtj
��G�fd�dtj��������fd�}�j|�j�	�5}�jjt	j||j��j�	��ddd�y#1swYyxYw)
Nr�rc�x��|j�j�|jt���}�j	t|�t���|j�d��|j
d�|jt���}�j	t|�t���|j
d�|jt���}�j	t|�t���|jtj�|j�y)NTr�r��2r�r�s  ���rr�z=BaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.servews�����O�O�D�L�L�)��=�=��Y��0�D����S��Y��I��7��N�N�>�t�N�<��L�L����=�=��Y��0�D����S��Y��I��7��L�L����=�=��Y��0�D����S��Y��I��7��M�M�&�*�*�+��J�J�Lrc�.��eZdZd�Z�fd�Zd�Z�fd�Zy)�HBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirstc�2�||_td�|_yr�)r�r�r�)rr�s  rr�zQBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.__init__�s��&���$�Q�<��rc����dz
�yr�r�rr��client_con_made_callss  �rr8zXBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.connection_made�����%��*�%rc��|jSr)r�r�s  rr�zSBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.get_buffer�s���x�x�rc����j|d�|jjt|jd|��yr�)ror�r��bytesr�)�slfr�rs  �rr�zWBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.buffer_updated�s4���� � ���*����&�&�u�S�W�W�V�e�_�'=�>rN)r�r�r�r�r8r�r�)rrs��r�ClientProtoFirstr
�s���
(�
+�
 �
?rrc�*��eZdZd�Z�fd�Zd�Zd�Zy)�IBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecondc�.�||_||_d|_yr�r�r�s   rr�zRBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.__init__�r�rc����dz
�yr�rr
s  �rr8zYBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.connection_made�rrc�:�|jj|�yrr�r�s  rr�zWBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.data_received�r�rc�:�|jjd�yr�r�r�s rrJzVBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.eof_received�r�rNr�)rs�r�ClientProtoSecondr�s���
&�

+�
.�
-rrc����K�tjd��d{����jj���jj�}�jj�}�jj��fd�g|����d{���\}}|j�	��jj
||���d{���}�j��d{���d�|j�	�|j�||���j|�d{���d�|j�	�|�d{���|j��j�
d�y7��P7��7��7��7�P7�2�w)Nr�c������Srr)r�on_data1s��rrlzPBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.client.<locals>.<lambda>�s���(��2rr�rr�)
r
r�rrIr�r6r�ror{r*)
r��on_data2r�r�rr�rrrr�rr�rs
      @������rr�z>BaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.client�s7������-�-��$�$�$��y�y�.�.�0�H��y�y�.�.�0�H��Y�Y�,�,�.�F�9�d�i�i�9�9�2�;�59�;�;�I�B��
�H�H�Y���9�9�.�.�r�5�.�I�I�F����8�^�T�2��L�L��#���� 1�(�F� C�D����8�^�T�2��L�L��#��L�L��L�L�N�

���2�A�6�3
%��;��J��+��,���sk�E:�E-�A6E:�E0�8E:�
E2�E:�"E4�#AE:�%E6�&E:�E8�(E:�0E:�2E:�4E:�6E:�8E:r�)
r�r"r�r�r
r�r$r�r�rr�r�r�)
rr�r�r�rrr�rr�r�s
`   @@@@@@r�!test_start_tls_client_buf_proto_1z.BaseStartTLS.test_start_tls_client_buf_proto_1os�����4�,�,�,�	�#�<�<�>��#�<�<�>�� !��	�&	?�w�7�7�	?� 	-�� 0� 0�	-� 	7�	7�8�_�_�U�D�L�L�_�
9�S��I�I�(�(�� � �����!1�)-���7�
8�:�
9�
9�s
�&AC:�:Dc��������d�jz�tj���jj	�����fd�}G�fd�dt
j�������fd�}�j|�j��5}�jjtj||j�tj���ddd�y#1swYyxYw)Nr�c���|j�j�|jt���}�j	t|�t���	�j
j
�jd�|jd�}|j�y#t$rY�wxYw#|j�wxYw�N�)
r�r�r�r�ror�call_soon_threadsafer�r]r*)r�r�r�r�server_waits_on_handshakes  ���rr�z=BaseStartTLS.test_start_tls_slow_client_cancel.<locals>.serve�s�����O�O�D�L�L�)��=�=��Y��0�D����S��Y��I��7�
��	�	�.�.�-�8�8�$�@��}�}�[�1���
�
���*�
��
���
�
��s$�7B$�$	B0�-B3�/B0�0B3�3Cc�*��eZdZd�Z�fd�Zd�Zd�Zy)�CBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProtoc�.�||_||_d|_yr�r�r�s   rr�zLBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.__init__�r�rc�h��|xjdz
c_�j|jd�yr�r�r�s  �rr8zSBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.connection_made�r�rc�:�|jj|�yrr�r�s  rr�zQBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.data_received�r�rc�:�|jjd�yr�r�r�s rrJzPBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.eof_received�r�rNr�r�s�rr�r(�r�rr�c��.���K�tjd��d{����jj���jj���jj���fd�g|����d{���\}}|j���	�d{����j
tj�5tj�jj||��d��d{���ddd�y7��7��7�j7�#1swYyxYw�w)Nr�c�������Srrr�s���rrlzPBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.client.<locals>.<lambda>�r�r)
r
r�rrIr�r6�assertRaises�TimeoutErrorr�r�)
r�r�rr�r�r�r�r�rr&s
   @@�����rr�z>BaseStartTLS.test_start_tls_slow_client_cancel.<locals>.client�s�������-�-��$�$�$��i�i�-�-�/�G��Y�Y�,�,�.�F�9�d�i�i�9�9�4�=�7;�=�=�I�B��
�H�H�Y��+�+�+��"�"�7�#7�#7�8��&�&��I�I�'�'��E�>�B�����9�8�
%��
=��

,����9�8�s^�D�D�AD�<D�=D�D�#D�>5D	�3D�4D	�8
D�D�D�D	�	D�Dr�)r�r"r�rrIr
r$r�r�r�r�r�rr�)rr�r�r�r�r�r�r&s`   @@@@r�!test_start_tls_slow_client_cancelz.BaseStartTLS.test_start_tls_slow_client_cancel�s�����4�,�,�,�	�#�<�<�>��$(�I�I�$;�$;�$=�!�
	�	-�'�*�*�	-�"	�	�$�_�_�U�D�L�L�_�
9�S��I�I�(�(�� � �����!1�)0�)>�)>�@�
A�:�
9�
9�s
�AC#�#C,c�8���������	�d�jz�d�tj��	tj��d������fd��G�fd�dtj
������	fd��������fd�}�jj|��y)Nr�sanswerc�r��|j�j�|j|�|jt	���}�jt	|�t	���|j
��|j��|jt	����|j�yr)	r�r��connectr�r�ror�r�r*)r�r�r��ANSWERr��answerr�rs   �����rr�z4BaseStartTLS.test_start_tls_server_1.<locals>.clients|����O�O�D�L�L�)��L�L����=�=��Y��0�D����S��Y��I��7��N�N�>�*��L�L��#��]�]�3�v�;�/�F��J�J�Lrc�0��eZdZd�Zd�Zd�Z�fd�Zd�Zy)�9BaseStartTLS.test_start_tls_server_1.<locals>.ServerProtoc�J�||_||_||_d|_d|_yr�)�on_con�on_con_lost�on_got_hellor�r9)rr:r;r<s    rr�zBBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.__init__s'��$���#.�� �$0��!���	�!%��rc�H�||_|jj|�yr)r9r:r��rr�s  rr8zIBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.connection_made&s��!#������&�&�r�*rc��||_yr)r9r>s  r�replace_transportzKBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.replace_transport*s	��!#��rc���|xj|z
c_t|j�t��k\r|jjd�yyr)r�r�r<r�)rr�r�s  �rr�zGBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.data_received-s>����	�	�T�!�	��t�y�y�>�S��^�3��%�%�0�0��6�4rc��d|_|�|jjd�y|jj|�yr)r9r;r��
set_exception)r�excs  rr\zIBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.connection_lost2s6��!%����;��$�$�/�/��5��$�$�2�2�3�7rN)r�r�r�r�r8r@r�r\)r�s�r�ServerProtor8s���
&�
+�
$�
7�

8rrEc���K�|�d{���}|j���j|jd��jj	||�	d�j
���d{���}|j
|�|�d{���|j��|�d{����j|j��|j�y7��7�i7�P7�7�w)NrT)r�r!)r6ror�rr�r�r@r*)
rr:r;r<r�r�r5r�rr�s
      ����r�mainz2BaseStartTLS.test_start_tls_server_1.<locals>.main9s��������B��H�H�Y�����U�Z�Z��-��9�9�.�.��E�>� �&*�l�l�/�4�4�F�
�#�#�F�+�����L�L�� �������U�Z�Z��3��L�L�N�!��
4��
��
�sF�C�C�AC�(C�)C�C�C�C�2C�C�C�Cc	�����K��jj�}�jj�}�jj�}�|||���jj�fd�dd��d{���}|jdj	���j��	fd��j��5tj�
�|||��j���d{���ddd�|j�|j��d{����j���y7��7�I#1swY�HxYw7�'�w)Nc����Srrres�rrlzHBaseStartTLS.test_start_tls_server_1.<locals>.run_main.<locals>.<lambda>Ss���rz	127.0.0.1rc����|��Srr)r�r�r�s ��rrlzHBaseStartTLS.test_start_tls_server_1.<locals>.run_main.<locals>.<lambda>Vs���f�T�4�.@rr�)rrI�
create_server�sockets�getsockname�
tcp_clientr�r
r�r*�wait_closedro)r:r;r<�serverr�rr5rEr6r�rGrs    @@������r�run_mainz6BaseStartTLS.test_start_tls_server_1.<locals>.run_mainLs������Y�Y�,�,�.�F��)�)�1�1�3�K��9�9�2�2�4�L����\�B�E��9�9�2�2��{�A�/�/�F��>�>�!�$�0�0�2�D����!@�)-���!�7��&�&�����\�B� �L�L�*�*�*�7�
�L�L�N��$�$�&�&�&����V�V�,�/��*��7�7��
'�sI�A<E�D:�AE�.D>�2D<�3D>�7+E�"E
�#E�<D>�>E�E)r�r"r�r�r
r$rr�)
rrQr5r�rEr6r�r�rGr�s
` @@@@@@@@r�test_start_tls_server_1z$BaseStartTLS.test_start_tls_server_1s{�����4�,�,�,�	���#�<�<�>��#�<�<�>����	�	�	8�'�*�*�	8�6	�&	-�	-�(	
�	�	�$�$�X�Z�0rc�P���fd�}�jj|��y)Nc��~�K��jtd�5�jjddd��d{���ddd�t	j
�}�jtd�5�jjdd|��d{���ddd�y7�e#1swY�dxYw7�#1swYyxYw�w)NzSSLContext, gotzis not supported)r>�	TypeErrorrr�r"r�)�sslctxrs �rrGz4BaseStartTLS.test_start_tls_wrong_args.<locals>.maincs�������'�'�	�3D�E��i�i�)�)�$��d�;�;�;�F� �8�8�:�F��'�'�	�3E�F��i�i�)�)�$��f�=�=�=�G�F�<��F�E��
>��G�F�sV�B=�!B#�B!�B#�2B=�2!B1�B/�B1�	B=�!B#�#B,�(B=�/B1�1B:�6B=)rr�)rrGs` r�test_start_tls_wrong_argsz&BaseStartTLS.test_start_tls_wrong_argsbs���	>�	
�	�	�$�$�T�V�,rc�b�����tj��g��jj�fd��d��fd�}��fd�}�j	|dd��5}�jtj�5�jj||j��ddd�ddd��j���j�g�tj���tj��j!���y#1swY�txYw#1swY�xxYw)Nc�&���j|�Srrgris  �rrlz5BaseStartTLS.test_handshake_timeout.<locals>.<lambda>srmrFc���	|jd�|j�y#t$rd�Y�wxYw#|j�wxYw)Nr$T�r�r]r*)r��server_side_aborteds �rrPz3BaseStartTLS.test_handshake_timeout.<locals>.serverwsB���
��
�
�k�*��
�
���*�
+�&*�#�
+���
�
��s�%�3�6�3�6�Ac	����K�tj�jjtjg|���dt
jd��d��d{���y7��w)N��r2�server_hostnamer!r�)r
r�rr�r$rr�)r��
client_sslctxrs ��rr�z3BaseStartTLS.test_handshake_timeout.<locals>.client�sb������"�"�+��	�	�+�+��$�$�A��A�&�$&�*1�*?�*?�A���
�
�s�AA!�A�A!r���max_clients�backlog)r"r�rrnr�r/r
r0r�r�r`ror�r�rr�rt)rrPr�r�rarkr\s`   @@@r�test_handshake_timeoutz#BaseStartTLS.test_handshake_timeoutms����#�;�;�=�
����	�	�'�'�(N�O�#��	�	��_�_�V�)*�%&��(�+.��"�"�7�#7�#7�8��	�	�,�,�V�C�H�H�-=�>�9�	(�	
���+�,�	
����2�&� ���M�2�
��������-�/�*�9�8��	(�(�s$� D%�:,D�&D%�D"	�D%�%D.c����tj��g�|jj�fd��d�}�fd�}|j	|dd��5}|jtd�5|jj||j��ddd�ddd�|j�g�y#1swY�$xYw#1swY�(xYw)Nc�&���j|�Srrgris  �rrlzHBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.<lambda>�rmrc��	|jd�|j�y#t$rY�wxYw#|j�wxYwr#r[)r�s rrPzFBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.server�s>��
��
�
�k�*��
�
���*�
��
���
�
��s�$�	0�3�0�3�Ac��V�K�tj|�ddd���d{���\}}y7��w)Nr^g�?r_)r
�open_connection�r��reader�writerras   �rr�zFBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.client�s1�����#*�#:�#:��!� "�&)�	$+�+�N�F�F�+�s�)�'�	)r�rbzSSL handshake.*is taking longer)
r"r�rrnr�r>r]r�r�ro)rrPr�r�rarks    @@r�)test_create_connection_ssl_slow_handshakez6BaseStartTLS.test_create_connection_ssl_slow_handshake�s����"�;�;�=�
����	�	�'�'�(N�O�	�	+��_�_�V�)*�%&��(�+.��'�'�*�6�8��	�	�,�,�V�C�H�H�-=�>�	8�	(�	
����2�&�
8�8��	(�(�s$�C�*,B9�C�9C	�>C�Cc����|jjd��tj��tjd����fd�}�fd�}|j|dd��5}|j
tj�5|jj||j��ddd�ddd�y#1swY�xYw#1swYyxYw)Nc��yrr�rrjs  rrlzLBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.<lambda>����$rF)�disable_verifyc���	|j�d��|j	�y#tj$rY�&t$rY�0wxYw#|j	�wxYw)NTr�)r�r2�SSLError�OSErrorr*)r�rVs �rrPzJBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.server�sY���	
����� $��&��
�
����<�<�
���
��
���
�
��s+�'�A�A
�A�A
�A�A
�
Ac��r�K�tj|�dtjd���d{���\}}y7��w)Nr^r_)r
rjr�LOOPBACK_TIMEOUTrks   �rr�zJBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.client�s:�����#*�#:�#:��!� "�&-�&>�&>�	$@�@�N�F�F�@�s�)7�5�	7r�rb)rrnr"r�r�r�r/r2�SSLCertVerificationErrorr�r�)rrPr�r�rarVs    @@r�-test_create_connection_ssl_failed_certificatez:BaseStartTLS.test_create_connection_ssl_failed_certificate�s�����	�	�'�'�(>�?��4�4�6��"�;�;� �"�
�
	�	@��_�_�V�)*�%&��(�+.��"�"�3�#?�#?�@��	�	�,�,�V�C�H�H�-=�>�A�	(�(�A�@��	(�(�s$�' C�,C�3C�C
	�	C�Cc�t�����jjd��tj��tj���fd�}��fd�}�j|dd��5}�jj
||j��}ddd��jd�y#1swY�xYw)Nc��yrrrqs  rrlzBBaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.<lambda>�rrrc�p��|j�}	|j�d��|jd�|jd�|j	d�|j�|j�y#t
j$rY�6wxYw#|j�|j�wxYw)NTr��A
r�s!please corrupt the SSL connection)�dupr�r�r��sendr2rur*)r��	orig_sockrVs  �rrPz@BaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.server�s�������
�I�
����� $��&����V�$��
�
�a� ����C�D����!��
�
���	�<�<�
��
�����!��
�
��s$�AA:�:B�
B�B�B�"B5c���K�tj|�dd���d{���\}}�j|j��d{���d�|j	d��jtj�5|j��d{���ddd�|j�y7��7�m7�!#1swY� xYw�w)Nr^)r2r`r~�B�OK)	r
rjro�readliner6r/r2rur*)r�rlrmrars   ��rr�z@BaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.client�s������#*�#:�#:��!� "�$$�$�N�F�F�

���6�?�?�#4�4�f�=��L�L����"�"�3�<�<�0��o�o�'�'�'�1�
�L�L�N��$��
5��(��1�0�sK�C�B/�%C�B1�9C�=B5�B3�B5�C�1C�3B5�5B>�:Cr�rbr�)	rrnr"r�r�r�r�r�ro)rrPr�r��resrarVs`    @@r�#test_start_tls_client_corrupted_sslz0BaseStartTLS.test_start_tls_client_corrupted_ssl�s�����	�	�'�'�(>�?��4�4�6��"�;�;�=�
�
	�	��_�_�V�)*�%&��(�+.��)�)�.�.�v�c�h�h�/?�@�C�	(�	
����d�#�
(�(�s�',B.�.B7N)r�r�r�r�r�LONG_TIMEOUTr�r�r�r�rr�skip_if_tcp_blackholer r1rRrWrernrzr�rrrr�r��s����L��"�"�G�"�-H�^@,�D>,�@�(�(�Y8�)�Y8�v;A�z�(�(�W1�)�W1�r	-�.+�`'�B?�B)$rr�c��eZdZd�Zy)�SelectorStartTLSTestsc�*�tj�Sr)r
�SelectorEventLoopr�s rr�zSelectorStartTLSTests.new_loop����(�(�*�*rN�r�r�r�r�rrrr�r�s��+rr��ProactorEventLoopzWindows onlyc��eZdZd�Zy)�ProactorStartTLSTestsc�*�tj�Sr)r
r�r�s rr�zProactorStartTLSTests.new_loopr�rNr�rrrr�r�s��+rr��__main__) rVrs�unittestr��testr�test.supportrrr2�ImportErrorr
rrr�test.test_asyncior	r"r
�
func_testsr�skipIf�TestCaser�FunctionalTestCaseMixinr�r��
skipUnless�hasattrr�r�rGrrr�<module>r�sB��$��
����&��������1�6�(��������o�.�R1�Z�0�0�R1�/�R1�tR	$�:�5�5�R	$�j�������o�.�+�L�(�*;�*;�+�/�+��������o�.�����W�W�&9�:�N�K�+�L�(�*;�*;�+�L�/�+��z���H�M�M�O���]��
�C��s�D!�!D,�+D,

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists