def receive_data(self, data: bytes) -> None:
    'Receive data from the remote.\n\n        A list of events that the remote peer triggered by sending\n        this data can be retrieved with :meth:`events`.\n\n        :param bytes data: Data received from the WebSocket peer.\n        '
    self._h11_connection.receive_data(data)
    while True:
        try:
            event = self._h11_connection.next_event()
        except h11.RemoteProtocolError:
            raise RemoteProtocolError('Bad HTTP message', event_hint=RejectConnection())
        if (isinstance(event, h11.ConnectionClosed) or (event is h11.NEED_DATA) or (event is h11.PAUSED)):
            break
        if self.client:
            if isinstance(event, h11.InformationalResponse):
                if (event.status_code == 101):
                    self._events.append(self._establish_client_connection(event))
                else:
                    self._events.append(RejectConnection(headers=event.headers, status_code=event.status_code, has_body=False))
                    self._state = ConnectionState.CLOSED
            elif isinstance(event, h11.Response):
                self._state = ConnectionState.REJECTING
                self._events.append(RejectConnection(headers=event.headers, status_code=event.status_code, has_body=True))
            elif isinstance(event, h11.Data):
                self._events.append(RejectData(data=event.data, body_finished=False))
            elif isinstance(event, h11.EndOfMessage):
                self._events.append(RejectData(data=b'', body_finished=True))
                self._state = ConnectionState.CLOSED
        elif isinstance(event, h11.Request):
            self._events.append(self._process_connection_request(event))
Receive data from the remote.

A list of events that the remote peer triggered by sending
this data can be retrieved with :meth:`events`.

:param bytes data: Data received from the WebSocket peer.
def receive_data(self, data: bytes) -> None:
    'Receive data from the remote.\n\n        A list of events that the remote peer triggered by sending\n        this data can be retrieved with :meth:`events`.\n\n        :param bytes data: Data received from the WebSocket peer.\n        '
    self._h11_connection.receive_data(data)
    while True:
        try:
            event = self._h11_connection.next_event()
        except h11.RemoteProtocolError:
            raise RemoteProtocolError('Bad HTTP message', event_hint=RejectConnection())
        if (isinstance(event, h11.ConnectionClosed) or (event is h11.NEED_DATA) or (event is h11.PAUSED)):
            break
        if self.client:
            if isinstance(event, h11.InformationalResponse):
                if (event.status_code == 101):
                    self._events.append(self._establish_client_connection(event))
                else:
                    self._events.append(RejectConnection(headers=event.headers, status_code=event.status_code, has_body=False))
                    self._state = ConnectionState.CLOSED
            elif isinstance(event, h11.Response):
                self._state = ConnectionState.REJECTING
                self._events.append(RejectConnection(headers=event.headers, status_code=event.status_code, has_body=True))
            elif isinstance(event, h11.Data):
                self._events.append(RejectData(data=event.data, body_finished=False))
            elif isinstance(event, h11.EndOfMessage):
                self._events.append(RejectData(data=b, body_finished=True))
                self._state = ConnectionState.CLOSED
        elif isinstance(event, h11.Request):
            self._events.append(self._process_connection_request(event))