Add hook for receiving stream RST error. (dart-lang/http2#9)

* Add hook for receiving stream RST error.

Normally, a stream RST is delivered as an error on the incoming stream,
but if the incoming stream has already been consumed, there is no good
way to detect that the stream has been terminated.

Added a `onCancel` hook, allowing user code to register a callback that
is invoked when a RST frame is received. The gRPC code uses this to
detect when a call has been canceled.

* Review feedback.

Renamed onCancel to onTerminated and made it a setter.
Updated SDK dependency for new Function syntax.

* Missed one.

* Added test for server termination. Made _handleTerminate private.
4 files changed
tree: fb1160e355ef3d754ffcfaff99946d89fbddd798
  1. pkgs/