'Called whenever a chunk of data is received from the transport.
@param data: The data received from the transport.
@type data: L{bytes}'

def dataReceived(self, data):

    self.resetTimeout()
    try:
        events = self.conn.receive_data(data)
    except h2.exceptions.ProtocolError:
        dataToSend = self.conn.data_to_send()
        self.transport.write(dataToSend)
        self.transport.loseConnection()
        self.connectionLost(Failure())
        return
    for event in events:
        if isinstance(event, h2.events.RequestReceived):
            self._requestReceived(event)
        elif isinstance(event, h2.events.DataReceived):
            self._requestDataReceived(event)
        elif isinstance(event, h2.events.StreamEnded):
            self._requestEnded(event)
        elif isinstance(event, h2.events.StreamReset):
            self._requestAborted(event)
        elif isinstance(event, h2.events.WindowUpdated):
            self._handleWindowUpdate(event)
        elif isinstance(event, h2.events.PriorityUpdated):
            self._handlePriorityUpdate(event)
        elif isinstance(event, h2.events.ConnectionTerminated):
            self.transport.loseConnection()
            self.connectionLost(ConnectionLost('Remote    peer    sent    GOAWAY'))
    dataToSend = self.conn.data_to_send()
    if dataToSend:
        self.transport.write(dataToSend)
