#NEWLINE# def test_stream_can_be_reset_multiple_times( self ) : #NEWLINE# #INDENT# '\n        Confirm that hyper gracefully handles receiving multiple RST_STREAM\n        frames.\n        ' #NEWLINE# self . set_up ( ) #NEWLINE# recv_event = threading . Event ( ) #NEWLINE# def socket_handler( listener ) : #NEWLINE# #INDENT# sock = listener . accept ( ) [ 0 ] #NEWLINE# receive_preamble ( sock ) #NEWLINE# sock . recv ( 65535 ) #NEWLINE# for _ in range ( 0 , 2 ) : #NEWLINE# #INDENT# f = RstStreamFrame ( 1 ) #NEWLINE# sock . send ( f . serialize ( ) ) #NEWLINE# #UNINDENT# recv_event . wait ( 5 ) #NEWLINE# sock . close ( ) #NEWLINE# #UNINDENT# self . _start_server ( socket_handler ) #NEWLINE# conn = self . get_connection ( ) #NEWLINE# conn . request ( 'GET' , '/' ) #NEWLINE# conn . _single_read ( ) #NEWLINE# conn . _single_read ( ) #NEWLINE# with pytest . raises ( StreamResetError ) : #NEWLINE# #INDENT# conn . get_response ( 1 ) #NEWLINE# #UNINDENT# assert ( conn . reset_streams == set ( [ 1 ] ) ) #NEWLINE# recv_event . set ( ) #NEWLINE# self . tear_down ( )