File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -478,6 +478,26 @@ async def runner():
478
478
479
479
self .loop .run_until_complete (runner ())
480
480
481
+ def test_create_connection_5 (self ):
482
+ def server (sock ):
483
+ data = sock .recv_all (4 )
484
+ self .assertEqual (data , b'AAAA' )
485
+ sock .send (b'OK' )
486
+
487
+ async def client (addr ):
488
+ fut = asyncio .ensure_future (
489
+ self .loop .create_connection (asyncio .Protocol , * addr ),
490
+ loop = self .loop )
491
+ await asyncio .sleep (0 , loop = self .loop )
492
+ fut .cancel ()
493
+ with self .assertRaises (asyncio .CancelledError ):
494
+ await fut
495
+
496
+ with self .tcp_server (server ,
497
+ max_clients = 1 ,
498
+ backlog = 1 ) as srv :
499
+ self .loop .run_until_complete (client (srv .addr ))
500
+
481
501
def test_transport_shutdown (self ):
482
502
CNT = 0 # number of clients that were successful
483
503
TOTAL_CNT = 100 # total number of clients that test will create
You can’t perform that action at this time.
0 commit comments