Skip to content

Commit

Permalink
Add a test showing failure to close peer (#56)
Browse files Browse the repository at this point in the history
Example for flutter#55
  • Loading branch information
natebosch authored Jun 9, 2020
1 parent 5458a9e commit a48ca46
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2.2.2-dev

## 2.2.1

* Fix `Peer` requests not terminating when the underlying channel is closed.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json_rpc_2
version: 2.2.1
version: 2.2.2-dev
description: >-
Utilities to write a client or server using the JSON-RPC 2.0 spec.
homepage: https://github.com/dart-lang/json_rpc_2
Expand Down
11 changes: 11 additions & 0 deletions test/peer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ void main() {
});
});

test('can be closed', () async {
var incomingController = StreamController();
var channel = StreamChannel.withGuarantees(
incomingController.stream,
StreamController(),
);
var peer = json_rpc.Peer.withoutJson(channel);
unawaited(peer.listen());
await peer.close();
}, skip: 'https://github.com/dart-lang/json_rpc_2/issues/55');

group('like a server,', () {
test('can receive a call and return a response', () {
expect(outgoing.first,
Expand Down

0 comments on commit a48ca46

Please sign in to comment.