#NEWLINE# def run( self ) : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# state = self . protocol . state #NEWLINE# if ( state in SERVER_STATES ) : #NEWLINE# #INDENT# self . direction = self . SERVER_TO_CLIENT #NEWLINE# self . readStream = self . serverStream #NEWLINE# self . writeStream = self . clientStream #NEWLINE# n = self . cycle ( self . protocol . readServer ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( state in CLIENT_STATES ) : #NEWLINE# #INDENT# self . direction = self . CLIENT_TO_SERVER #NEWLINE# self . readStream = self . clientStream #NEWLINE# self . writeStream = self . serverStream #NEWLINE# n = self . cycle ( self . protocol . readClient ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert False , ( 'Unknown state %s' % state ) #NEWLINE# #UNINDENT# #UNINDENT# if ( n < 0 ) : #NEWLINE# #INDENT# return n