I don't think we should check if the dataHandler is null here. Consider the following case.

There are several pending buffers in the queue
The user sets the datahandler to null
The user calls resume - this then drops the data!
The user sets the datahandlee back to the handler
The data handler never gets called with the data because it was dropped.

I think we should only check if the dataHandler is null in the handleDataReceived method