#NEWLINE# def verifySocksReply( self , data ) : #NEWLINE# #INDENT# '\n        Return True on success and False on need-more-data or error.\n        In the case of an error, the connection is closed and the\n        handshakeDone errback is invoked with a SOCKSError exception\n        before False is returned.\n        ' #NEWLINE# if ( len ( data ) < 8 ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( ord ( data [ 0 ] ) != 0 ) : #NEWLINE# #INDENT# self . transport . loseConnection ( ) #NEWLINE# self . handshakeDone . errback ( SOCKSError ( ( 1 , 'bad data' ) ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# status = ord ( data [ 1 ] ) #NEWLINE# if ( status != 90 ) : #NEWLINE# #INDENT# self . transport . loseConnection ( ) #NEWLINE# self . handshakeDone . errback ( SOCKSError ( ( data , ( 'request not granted: %d' % status ) ) ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# return True