def connect(self):
try:<EOL><INDENT>logger.info(u'<STR_LIT>' % (self.host, self.port))<EOL>self.sock.connect((self.host, self.port))<EOL><DEDENT>except socket.error:<EOL><INDENT>raise ConnectionError()<EOL><DEDENT>self.state = CONNECTED<EOL>
Connect to the server

        :raise ConnectionError: If socket cannot establish a connection