o
    JXhg                     @   sR  d Z ddlZddlZddlZddlZddlmZ zddlZW n ey)   dZY nw ddlZddlm	Z	 ddlm
Z
 ddlmZ ddlmZ ddlmZ dd	lmZ d
d Zeedu dG dd dejZG dd dejZeedu dG dd deejZeedu deeeddG dd deejZedkre  dS dS )zTests for asyncio/sslproto.py.    N)mock)log)	protocols)sslproto)support)utils)
functionalc                   C   s   t d  d S N)asyncioZset_event_loop_policy r   r   I/opt/python-3.10.19/usr/lib/python3.10/test/test_asyncio/test_sslproto.pytearDownModule   s   r   zNo ssl modulec                       s   e Zd Z fddZdddddZdddd	Zd
d Zdd Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Z  ZS )SslProtoHandshakeTestsc                    s$   t    t | _| | j d S r	   )supersetUpr
   Znew_event_looploopZset_event_loopself	__class__r   r   r      s   

zSslProtoHandshakeTests.setUpN)waiterprotoc                C   sR   t  }|d u rt }tj| j|||dd}| |j	 | | 
|jj |S )Ng?ssl_handshake_timeout)
test_utilsdummy_ssl_contextr
   Protocolr   SSLProtocolr   assertIs_app_transportget_protocolZ
addCleanupclose)r   r   r   
sslcontext	ssl_protor   r   r   ssl_protocol"   s   z#SslProtoHandshakeTests.ssl_protocol)do_handshakec                C   st   t  }t  }d|j_|r||j_ndd }||j_t jd|d || W d    |S 1 s3w   Y  |S )N    c                 S   s   g S r	   r   )callbackr   r   r   mock_handshake3      z>SslProtoHandshakeTests.connection_made.<locals>.mock_handshakezasyncio.sslproto._SSLPipe)return_value)r   Mockshutdownr*   r%   Zside_effectZpatchconnection_made)r   r#   r%   	transportZsslpiper(   r   r   r   r-   ,   s   

z&SslProtoHandshakeTests.connection_madec                 C   `   t  }t }t }| td tj| j|||dd W d    d S 1 s)w   Y  d S )Na positive numberr   r   	r   r   r   r+   assertRaisesRegex
ValueErrorr   r   r   r   r"   Z	app_protor   r   r   r   test_handshake_timeout_zero:      "z2SslProtoHandshakeTests.test_handshake_timeout_zeroc                 C   r/   )Nr0   ir   r1   r4   r   r   r   test_handshake_timeout_negativeB   r6   z6SslProtoHandshakeTests.test_handshake_timeout_negativec                 C   sH   | j  }| j|d}| | |  t| j  | | t	 d S Nr   )
r   create_futurer$   r-   eof_receivedr   run_brieflyassertIsInstance	exceptionConnectionResetErrorr   r   r#   r   r   r   test_eof_received_waiterJ   s   

z/SslProtoHandshakeTests.test_eof_received_waiterc              	   C   sZ   | j  }| j|d}tj }tjtj z|	d  W tj| d S tj| w r8   )
r   r:   r$   r   loggergetEffectiveLevelsetLevelloggingFATALZ_fatal_error)r   r   r#   Z	log_levelr   r   r   test_fatal_error_no_name_errorR   s   

z5SslProtoHandshakeTests.test_fatal_error_no_name_errorc                 C   sJ   | j  }| j|d}| | |t t| j  | |	 t d S r8   )
r   r:   r$   r-   connection_lostConnectionAbortedErrorr   r<   r=   r>   r@   r   r   r   test_connection_losta   s   


z+SslProtoHandshakeTests.test_connection_lostc                 C   sH   | j  }| j|d}| |}t| j  |j  | |j	j
 d S r8   )r   r:   r$   r-   r   r<   r   r!   
assertTrueabortZcalled)r   r   r#   r.   r   r   r   test_close_during_handshakek   s   


z2SslProtoHandshakeTests.test_close_during_handshakec                 C   sx   | j  }| j|d}| |d t }| |d|| | | | |d |	d  | |d d S )Nr9   socket)
r   r:   r$   assertIsNoneZ_get_extra_infoobjectr   r-   ZassertIsNotNonerH   )r   r   r#   defaultr   r   r   (test_get_extra_info_on_closed_connectionv   s   


z?SslProtoHandshakeTests.test_get_extra_info_on_closed_connectionc                 C   sN   | j  }| j|d}t }|j| | |j | | |j	| d S r8   )
r   r:   r$   r
   r   r   set_protocolr   r    Z_app_protocol)r   r   r#   Znew_app_protor   r   r   test_set_new_app_protocol   s   
z0SslProtoHandshakeTests.test_set_new_app_protocolc                 C   s4   |   }| | |j}|  | |d d S Ns   data)r$   r-   r   r!   rO   data_receivedr   r#   Ztranspr   r   r    test_data_received_after_closing   s
   
z7SslProtoHandshakeTests.test_data_received_after_closingc                 C   s4   |   }| | |j}|  | |d d S rU   )r$   r-   r   r!   rO   writerW   r   r   r   test_write_after_closing   s
   
z/SslProtoHandshakeTests.test_write_after_closing)__name__
__module____qualname__r   r$   r-   r5   r7   rA   rG   rJ   rM   rR   rT   rX   rZ   __classcell__r   r   r   r   r      s    


r   c                   @   sv   e Zd ZdZejZdd Zdd Zdd Z	dd	 Z
d
d Zdd Zdd Zdd Zdd Zdd Zdd Zdd ZdS )BaseStartTLSi  c                 C   s   t r	   )NotImplementedErrorr   r   r   r   new_loop   r)   zBaseStartTLS.new_loopc              	   C   s  G dd dt j}dD ]}}|d|}t|d | |jd |d|}t|d | |jd |d|}t|d | |jd |d|}t|d | |jd |d	|}t|d | |jd |d
|}| td t|d W d    n1 sw   Y  qd S )Nc                   @   s$   e Zd Zdd Zdd Zdd ZdS )z.BaseStartTLS.test_buf_feed_data.<locals>.Protoc                 S   s&   t || _t| j| _d| _|| _d S Nr&   )	bytearraybuf
memoryviewmvdatausemv)r   bufsizerh   r   r   r   __init__   s   

z7BaseStartTLS.test_buf_feed_data.<locals>.Proto.__init__c                 S   s   | j r| jS | jS r	   )rh   rf   rd   r   sizehintr   r   r   
get_buffer   s   z9BaseStartTLS.test_buf_feed_data.<locals>.Proto.get_bufferc                 S   s>   | j r|  j| jd | 7  _d S |  j| jd | 7  _d S r	   )rh   rg   rf   rd   )r   nsizer   r   r   buffer_updated   s   z=BaseStartTLS.test_buf_feed_data.<locals>.Proto.buffer_updatedN)r[   r\   r]   rj   rm   ro   r   r   r   r   Proto   s    rp   )FT   s   12345   s   1234   d   r   zempty buffer)r
   BufferedProtocolr   Z_feed_data_to_buffered_protoassertEqualrg   r2   RuntimeError)r   rp   rh   r   r   r   r   test_buf_feed_data   s.   





zBaseStartTLS.test_buf_feed_datac                       dj  t t fdd}G fdddtj  fdd}j|jd}j	tj
||jtjd W d    n1 sKw   Y  tt    d S )	N   1c                    s   |  j | t }t|t  | jdd | d | t }t|t  | tj	 | 
  d S NTserver_side   O
settimeoutTIMEOUTrecv_alllenrv   	start_tlssendallr,   rN   	SHUT_RDWRr!   sockrg   	HELLO_MSGr   server_contextr   r   serve   s   
z=BaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.servec                       0   e Zd Zdd Z fddZdd Zdd Zd	S )
zCBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProtoc                 S      || _ || _d| _d S Nr   on_dataon_eofcon_made_cntr   r   r   r   r   r   rj         
zLBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.__init__c                        |  j d7  _  | j d d S Nrq   r   rv   r   trr   r   r   r-         zSBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.connection_madec                 S      | j | d S r	   r   
set_resultr   rg   r   r   r   rV         zQBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.data_receivedc                 S      | j d d S NTr   r   r   r   r   r   r;      r   zPBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.eof_receivedNr[   r\   r]   rj   r-   rV   r;   r   r   r   r   ClientProto   
    r   c                    s   t dI d H  j  j jj fddg| R  I d H \}}| j||I d H } I d H d | I d H  |  d S )N      ?c                      
    S r	   r   r   r   r   r   r   r   <lambda>     
 zPBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.client.<locals>.<lambda>r~   )	r
   sleepr   r:   create_connectionrY   r   rv   r!   )addrr   r   new_trr   r   client_contextr   r   r   r   client   s   




z>BaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.clienttimeoutPAYLOAD_SIZEr   simple_server_sslcontextsimple_client_sslcontextr
   r   
tcp_serverr   r   run_until_completewait_forr   r   SHORT_TIMEOUTweakrefref
gc_collectrO   r   r   r   srvr   r   r   r   r   r   r   !test_start_tls_client_reg_proto_1   s    

z.BaseStartTLS.test_start_tls_client_reg_proto_1c                    ry   )	Nrz   c                    s^   |  j | jdd | d | t }t|t  | tj	 | 
  d S r{   )r   r   r   r   r   r   rv   r,   rN   r   r!   r   r   r   r   r   !  s   
z>BaseStartTLS.test_create_connection_memory_leak.<locals>.servec                       r   )
zDBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProtoc                 S   r   r   r   r   r   r   r   rj   .  r   zMBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.__init__c                    s&   || _ |  jd7  _ | jd d S r   )r   r   rv   r   r   r   r   r-   3  s   zTBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.connection_madec                 S   r   r	   r   r   r   r   r   rV   :  r   zRBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.data_receivedc                 S   r   r   r   r   r   r   r   r;   =  r   zQBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.eof_receivedNr   r   r   r   r   r   -  s
    r   c                    s   t dI d H  j  j jj fddg| R diI d H \}} I d H d | I d H  |  d S )Nr   c                      r   r	   r   r   r   r   r   r   G  r   zQBaseStartTLS.test_create_connection_memory_leak.<locals>.client.<locals>.<lambda>sslr~   )r
   r   r   r:   r   rv   rY   r!   r   r   r   r   r   r   r   @  s   



z?BaseStartTLS.test_create_connection_memory_leak.<locals>.clientr   r   r   r   r   r   "test_create_connection_memory_leak  s    

z/BaseStartTLS.test_create_connection_memory_leakc                    s   dj  t t dfdd}G fdddtj G fdddtj fd	d
}j|jd}j	
tj||jjd W d    d S 1 s\w   Y  d S )Nrz   r   c                    s   |  j | t }t|t  | jdd | d | t }t|t  | d | t }t|t  | tj	 | 
  d S )NTr|   r~      2r   r   r   r   r   r   b  s   

z=BaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.servec                       s4   e Zd Zdd Z fddZdd ZfddZd	S )
zHBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirstc                 S   s   || _ td| _d S r   )r   rc   rd   )r   r   r   r   r   rj   v  s   zQBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.__init__c                        d7  d S r   r   r   r   client_con_made_callsr   r   r-   z     zXBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.connection_madec                 S   s   | j S r	   )rd   rk   r   r   r   rm   ~  s   zSBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.get_bufferc                    s*     |d | jt| jd |  d S r   )rv   r   r   bytesrd   )Zslfrn   r   r   r   ro     s   zWBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.buffer_updatedN)r[   r\   r]   rj   r-   rm   ro   r   )r   r   r   r   ClientProtoFirstu  s
    r   c                       r   )
zIBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecondc                 S   r   r   r   r   r   r   r   rj     r   zRBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.__init__c                    r   r   r   r   r   r   r   r-     r   zYBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.connection_madec                 S   r   r	   r   r   r   r   r   rV     r   zWBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.data_receivedc                 S   r   r   r   r   r   r   r   r;     r   zVBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.eof_receivedNr   r   r   r   r   ClientProtoSecond  s
    r   c                    s   t dI d H  j  j }j }jj fddg| R  I d H \}}| j||I d H } I d H d | ||| |I d H d | |I d H  |	  d d S )Nr   c                      s    S r	   r   r   )r   on_data1r   r   r     s    zPBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.client.<locals>.<lambda>r~   r   rq   )
r
   r   r   r:   r   rY   r   rv   rS   r!   )r   Zon_data2r   r   r   r   )r   r   r   r   r   r   )r   r   r     s(   






z>BaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.clientr   )r   r   r   r   r
   ru   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   !test_start_tls_client_buf_proto_1[  s   
"z.BaseStartTLS.test_start_tls_client_buf_proto_1c                    s   dj  t j fdd}G fdddtj  fdd}j|jd}j	tj
||jtjd W d    d S 1 sNw   Y  d S )	Nrz   c                    s   |  j | t }t|t  z'zjjd  | d}W n	 ty0   Y nw W | 	  d S W | 	  d S | 	  w N   )
r   r   r   r   rv   r   Zcall_soon_threadsafer   rI   r!   r   )r   r   server_waits_on_handshaker   r   r     s   z=BaseStartTLS.test_start_tls_slow_client_cancel.<locals>.servec                       r   )
zCBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProtoc                 S   r   r   r   r   r   r   r   rj     r   zLBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.__init__c                    r   r   r   r   r   r   r   r-     r   zSBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.connection_madec                 S   r   r	   r   r   r   r   r   rV     r   zQBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.data_receivedc                 S   r   r   r   r   r   r   r   r;     r   zPBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.eof_receivedNr   r   r   r   r   r     r   r   c                    s   t dI d H  j  j jj fddg| R  I d H \}}| I d H  t j t j	||dI d H  W d    d S 1 sSw   Y  d S )Nr   c                      r   r	   r   r   r   r   r   r     r   zPBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.client.<locals>.<lambda>)
r
   r   r   r:   r   rY   assertRaisesTimeoutErrorr   r   r   r   r   r   r   r   r   r   r     s"   



"z>BaseStartTLS.test_start_tls_slow_client_cancel.<locals>.clientr   )r   r   r   r   r:   r
   r   r   r   r   r   r   r   r   r   r   r   r   !test_start_tls_slow_client_cancel  s   

"z.BaseStartTLS.test_start_tls_slow_client_cancelc                    s   dj  d t t d  fddG fdddtj fdd fd	d
}j|  d S )Nrz   s   answerc                    sf   |  j | | | t}t|t |  |  | t |   d S r	   )	r   r   connectr   r   rv   r   r   r!   )r   r   rg   )ANSWERr   answerr   r   r   r   r     s   


z4BaseStartTLS.test_start_tls_server_1.<locals>.clientc                       s8   e Zd Zdd Zdd Zdd Z fddZd	d
 ZdS )z9BaseStartTLS.test_start_tls_server_1.<locals>.ServerProtoc                 S   s"   || _ || _|| _d| _d | _d S rb   )on_conon_con_loston_got_hellorg   r.   )r   r   r   r   r   r   r   rj   	  s
   
zBBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.__init__c                 S   s   || _ | j| d S r	   )r.   r   r   r   r   r   r   r-     s   zIBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.connection_madec                 S   s
   || _ d S r	   )r.   r   r   r   r   replace_transport  s   
zKBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.replace_transportc                    s4   |  j |7  _ t| j t kr| jd  d S d S r	   )rg   r   r   r   r   r   r   r   rV     s   zGBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.data_receivedc                 S   s.   d | _ |d u r| jd  d S | j| d S r	   )r.   r   r   set_exception)r   excr   r   r   rH     s   zIBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.connection_lostN)r[   r\   r]   rj   r-   r   rV   rH   r   r   r   r   ServerProto  s    r   c                    s   |I d H }|  | jd jj|| djdI d H }| | |I d H  |   |I d H  | j |  d S )Nr&   T)r}   r   )rY   rv   rg   r   r   r   r   r!   )r   r   r   r   r   r   )r   r   r   r   r   r   main#  s   





z2BaseStartTLS.test_start_tls_server_1.<locals>.mainc                     s   j  } j  }j  }| ||j fddddI d H }|jd   j fddjd tj| ||jdI d H  W d    n1 sTw   Y  |	  |
 I d H   d S )Nc                      s    S r	   r   r   )r   r   r   r   =      zHBaseStartTLS.test_start_tls_server_1.<locals>.run_main.<locals>.<lambda>z	127.0.0.1r   c                    s
   |  S r	   r   r   )r   r   r   r   r   @  r   r   )r   r:   create_serverZsocketsgetsocknameZ
tcp_clientr   r
   r   r!   Zwait_closedrv   )r   r   r   server)r   r   r   r   r   r   )r   r   r   run_main6  s(   



z6BaseStartTLS.test_start_tls_server_1.<locals>.run_main)r   r   r   r   r
   r   r   r   )r   r   r   )	r   r   r   r   r   r   r   r   r   r   test_start_tls_server_1  s   
z$BaseStartTLS.test_start_tls_server_1c                    s    fdd} j |  d S )Nc                     s     td  jd d d I d H  W d    n1 sw   Y  t }   td  jd d | I d H  W d    d S 1 sCw   Y  d S )NzSSLContext, gotzis not supported)r2   	TypeErrorr   r   r   r   sslctxr   r   r   r   M  s   "z4BaseStartTLS.test_start_tls_wrong_args.<locals>.main)r   r   )r   r   r   r   r   test_start_tls_wrong_argsL  s   z&BaseStartTLS.test_start_tls_wrong_argsc              	      s   t   g jfdd dfdd} fdd}j|ddd	'}tj j||j	 W d    n1 sBw   Y  W d    n1 sQw   Y  
 g  t  t     d S )
Nc                    
     |S r	   appendr   ctxmessagesr   r   r   ]  r   z5BaseStartTLS.test_handshake_timeout.<locals>.<lambda>Fc                    sN   z!z|  d W n ty   d Y nw W |   d S W |   d S |   w )Nr   Tr   rI   r!   r   )server_side_abortedr   r   r   a  s   z3BaseStartTLS.test_handshake_timeout.<locals>.serverc                    s6   t jjt jg| R  dtjddI d H  d S )N r   server_hostnamer   r   )r
   r   r   r   r   r   r   )r   client_sslctxr   r   r   r   j  s   z3BaseStartTLS.test_handshake_timeout.<locals>.clientrq   Zmax_clientsbacklog)r   r   r   set_exception_handlerr   r   r
   r   r   r   rK   rv   r   r   r   r   rO   r   r   r   r   r   )r   r   r   r   r   test_handshake_timeoutW  s*   	


z#BaseStartTLS.test_handshake_timeoutc              	      s   t   g | jfdd dd } fdd}| j|ddd'}| td	 | j||j W d    n1 s=w   Y  W d    n1 sLw   Y  | 	g  d S )
Nc                    r   r	   r   r   r   r   r   r     r   zHBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.<lambda>c                 S   sJ   zz|  d W n	 ty   Y nw W |   d S W |   d S |   w r   r   r   r   r   r   r     s   zFBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.serverc                    s$   t j|  dddI d H \}}d S )Nr   g      ?r   )r
   open_connectionr   readerwriterr   r   r   r     s   zFBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.clientrq   r   zSSL handshake.*is taking longer)
r   r   r   r  r   r2   rI   r   r   rv   r  r   )r   r   r   )test_create_connection_ssl_slow_handshake  s&   
z6BaseStartTLS.test_create_connection_ssl_slow_handshakec              	      s   | j dd  t tjdd fdd} fdd}| j|d	d	d
0}| tj | j 	||j
 W d    n1 sAw   Y  W d    d S W d    d S 1 sYw   Y  d S )Nc                 S      d S r	   r   r   r   r   r   r     r   zLBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.<lambda>F)Zdisable_verifyc                    sn   z1z	| j  dd W n tjy   Y n ty   Y nw W |   d S W |   d S W |   d S |   w )NTr|   )r   r   SSLErrorOSErrorr!   r   r   r   r   r     s    
zJBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.serverc                    s&   t j|  dtjdI d H \}}d S )Nr   r   )r
   r  r   ZLOOPBACK_TIMEOUTr  r  r   r   r     s   zJBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.clientrq   r   )r   r  r   r   r   r   r   r   ZSSLCertVerificationErrorr   r   r  r   )r   r   r   -test_create_connection_ssl_failed_certificate  s$   "z:BaseStartTLS.test_create_connection_ssl_failed_certificatec                    s   j dd  t t  fdd} fdd}j|ddd}j ||j}W d    n1 s9w   Y  |d	 d S )
Nc                 S   r
  r	   r   r   r   r   r   r     r   zBBaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.<lambda>c                    s   |   }z9z| j dd | d | d |d W n
 tjy'   Y nw W |  |   d S W |  |   d S |  |   w )NTr|      A
rq   s!   please corrupt the SSL connection)dupr   r   r   sendr   r  r!   )r   Z	orig_sockr   r   r   r     s(   


z@BaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.serverc                    s   t j|  ddI d H \}}| I d H d |d tj | I d H  W d    n1 s7w   Y  |  dS )Nr   )r   r   r     BOK)	r
   r  rv   readlinerY   r   r   r  r!   r  r   r   r   r     s   
z@BaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.clientrq   r   r  )	r   r  r   r   r   r   r   r   rv   )r   r   r   r   resr   )r   r   r   r   #test_start_tls_client_corrupted_ssl  s   z0BaseStartTLS.test_start_tls_client_corrupted_sslN)r[   r\   r]   r   r   ZLONG_TIMEOUTr   ra   rx   r   r   r   r   r   r   r  r	  r  r  r   r   r   r   r_      s    /B@[=Y0!!r_   c                   @      e Zd Zdd ZdS )SelectorStartTLSTestsc                 C      t  S r	   )r
   ZSelectorEventLoopr   r   r   r   ra        zSelectorStartTLSTests.new_loopNr[   r\   r]   ra   r   r   r   r   r    s    r  ProactorEventLoopzWindows onlyc                   @   r  )ProactorStartTLSTestsc                 C   r  r	   )r
   r  r   r   r   r   ra      r  zProactorStartTLSTests.new_loopNr  r   r   r   r   r    s    r  __main__)__doc__rE   rN   Zunittestr   r   r   ImportErrorr
   r   r   r   testr   Ztest.test_asyncior   r   r   Z
func_testsr   ZskipIfZTestCaser   ZFunctionalTestCaseMixinr_   r  Z
skipUnlesshasattrr  r[   r   r   r   r   r   <module>   sF         W