def perform(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<EOL>sock.connect((self.host, self.port))<EOL>if not self.query:<EOL><INDENT>sock.close()<EOL>return True<EOL><DEDENT>try:<EOL><INDENT>sock.sendall(self.query)<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception("<STR_LIT>")<EOL>sock.close()<EOL>return False<EOL><DEDENT>response, extra = sockutils.get_response(sock)<EOL>logger.debug("<STR_LIT>", response, extra)<EOL>if response != self.expected_response:<EOL><INDENT>logger.warn(<EOL>"<STR_LIT>",<EOL>response, self.expected_response<EOL>)<EOL>sock.close()<EOL>return False<EOL><DEDENT>sock.close()<EOL>return True<EOL>
Performs a straightforward TCP request and response.

Sends the TCP `query` to the proper host and port, and loops over the
socket, gathering response chunks until a full line is acquired.

If the response line matches the expected value, the check passes. If
not, the check fails.  The check will also fail if there's an error
during any step of the send/receive process.