def _reject(self, event: RejectConnection) -> bytes:
    if (self.state != ConnectionState.CONNECTING):
        raise LocalProtocolError(('Connection cannot be rejected in state %s' % self.state))
    headers = event.headers
    if (not event.has_body):
        headers.append((b'content-length', b'0'))
    response = h11.Response(status_code=event.status_code, headers=headers)
    data = self._h11_connection.send(response)
    self._state = ConnectionState.REJECTING
    if (not event.has_body):
        data += self._h11_connection.send(h11.EndOfMessage())
        self._state = ConnectionState.CLOSED
    return data
def _reject(self, event: RejectConnection) -> bytes:
    if (self.state != ConnectionState.CONNECTING):
        raise LocalProtocolError(('Connection cannot be rejected in state %s' % self.state))
    headers = event.headers
    if (not event.has_body):
        headers.append((b'content-length', b'0'))
    response = h11.Response(status_code=event.status_code, headers=headers)
    data = self._h11_connection.send(response)
    self._state = ConnectionState.REJECTING
    if (not event.has_body):
        data += self._h11_connection.send(h11.EndOfMessage())
        self._state = ConnectionState.CLOSED
    return data