def receive_data(self, data):<EOL>
self._h11_connection.receive_data(data)<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>event = self._h11_connection.next_event()<EOL><DEDENT>except h11.RemoteProtocolError:<EOL><INDENT>raise RemoteProtocolError(<EOL>"<STR_LIT>", event_hint=RejectConnection()<EOL>)<EOL><DEDENT>if (<EOL>isinstance(event, h11.ConnectionClosed)<EOL>or event is h11.NEED_DATA<EOL>or event is h11.PAUSED<EOL>):<EOL><INDENT>break<EOL><DEDENT>if self.client:<EOL><INDENT>if isinstance(event, h11.InformationalResponse):<EOL><INDENT>if event.status_code == <NUM_LIT>:<EOL><INDENT>self._events.append(self._establish_client_connection(event))<EOL><DEDENT>else:<EOL><INDENT>self._events.append(<EOL>RejectConnection(<EOL>headers=event.headers,<EOL>status_code=event.status_code,<EOL>has_body=False,<EOL>)<EOL>)<EOL>self._state = ConnectionState.CLOSED<EOL><DEDENT><DEDENT>elif isinstance(event, h11.Response):<EOL><INDENT>self._state = ConnectionState.REJECTING<EOL>self._events.append(<EOL>RejectConnection(<EOL>headers=event.headers,<EOL>status_code=event.status_code,<EOL>has_body=True,<EOL>)<EOL>)<EOL><DEDENT>elif isinstance(event, h11.Data):<EOL><INDENT>self._events.append(<EOL>RejectData(data=event.data, body_finished=False)<EOL>)<EOL><DEDENT>elif isinstance(event, h11.EndOfMessage):<EOL><INDENT>self._events.append(RejectData(data=b"<STR_LIT>", body_finished=True))<EOL>self._state = ConnectionState.CLOSED<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if isinstance(event, h11.Request):<EOL><INDENT>self._events.append(self._process_connection_request(event))<EOL><DEDENT><DEDENT><DEDENT>
Receive data from the remote.

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