code: def receive_data(self, data):
          # type: (bytes) -> None
          
          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
              else:
                  if isinstance(event, h11.Request):
                      self._events.append(self._process_connection_request(event))
docs: Receive data from the remote.
  
          A list of events that the remote peer triggered by sending
          this data can be retrieved with :meth:`events`.