#NEWLINE# def test_stream_level_window_management( self ) : #NEWLINE# #INDENT# self . set_up ( ) #NEWLINE# data = [ ] #NEWLINE# send_event = threading . Event ( ) #NEWLINE# def socket_handler( listener ) : #NEWLINE# #INDENT# sock = listener . accept ( ) [ 0 ] #NEWLINE# sock . recv ( 65535 ) #NEWLINE# f = SettingsFrame ( 0 ) #NEWLINE# f . settings [ SettingsFrame . INITIAL_WINDOW_SIZE ] = 64 #NEWLINE# sock . send ( f . serialize ( ) ) #NEWLINE# for x in range ( 0 , 3 ) : #NEWLINE# #INDENT# data . append ( sock . recv ( 65535 ) ) #NEWLINE# #UNINDENT# f = WindowUpdateFrame ( 1 ) #NEWLINE# f . window_increment = 64 #NEWLINE# sock . send ( f . serialize ( ) ) #NEWLINE# f = WindowUpdateFrame ( 0 ) #NEWLINE# f . window_increment = 64 #NEWLINE# sock . send ( f . serialize ( ) ) #NEWLINE# data . append ( sock . recv ( 65535 ) ) #NEWLINE# send_event . set ( ) #NEWLINE# sock . close ( ) #NEWLINE# #UNINDENT# self . _start_server ( socket_handler ) #NEWLINE# conn = self . get_connection ( ) #NEWLINE# conn . putrequest ( 'GET' , '/' ) #NEWLINE# conn . endheaders ( ) #NEWLINE# sd = ( b'a' * 32 ) #NEWLINE# conn . send ( sd ) #NEWLINE# sd = ( sd * 2 ) #NEWLINE# conn . send ( sd , final = True ) #NEWLINE# assert send_event . wait ( 0.3 ) #NEWLINE# frames = [ decode_frame ( d ) for d in data ] #NEWLINE# assert ( isinstance ( frames [ ( - 2 ) ] , DataFrame ) and ( not isinstance ( frames [ ( - 2 ) ] , HeadersFrame ) ) ) #NEWLINE# assert ( len ( frames [ ( - 2 ) ] . data ) == 32 ) #NEWLINE# assert isinstance ( frames [ ( - 1 ) ] , DataFrame ) #NEWLINE# assert ( len ( frames [ ( - 1 ) ] . data ) == 64 ) #NEWLINE# self . tear_down ( )