def connect(self, username=None, passcode=None, wait=False, headers={}, **keyword_headers):
        cmd = CMD_STOMP
        headers = utils.merge_headers([headers, keyword_headers])
        headers[HDR_ACCEPT_VERSION] = self.version

        if self.transport.vhost:
            headers[HDR_HOST] = self.transport.vhost

        if username is not None:
            headers[HDR_LOGIN] = username

        if passcode is not None:
            headers[HDR_PASSCODE] = passcode

        self.send_frame(cmd, headers)

        if wait:
            self.transport.wait_for_connection()
            if self.transport.connection_error:
                raise ConnectFailedException()
Checks if message is valid and raises appropriate exception.
dataset/ETHPy150Open jasonrbriggs/stomp.py/stomp/protocol.py/Protocol11.connect--crossover with--dataset/ETHPy150Open Pylons/pyramid_mailer/pyramid_mailer/message.py/Message.validate