Cast streams to correct types in IsolateChannel (#31)

Fixes #29

- Add a type on the IsolateChannel in one of the tests so that it
  exhibits the problem when run in Dart 2 mode.
- Cast the streams coming from the ReceivePort instances to the
  appropriate types since ReceivePort is always `Stream<dynamic>`.
- Remove the type on the subscription variable since it's a subscription
  on a dynamic stream and otherwise would never have the correct type.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b284e5e..3dfbbc6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.6.7+1
+
+* Fix Dart 2 runtime types in `IsolateChannel`.
+
 ## 1.6.7
 
 * Update SDK version to 2.0.0-dev.17.0.
diff --git a/lib/src/isolate_channel.dart b/lib/src/isolate_channel.dart
index 4a1717d..d785ae1 100644
--- a/lib/src/isolate_channel.dart
+++ b/lib/src/isolate_channel.dart
@@ -49,12 +49,14 @@
     // The first message across the ReceivePort should be a SendPort pointing to
     // the remote end. If it's not, we'll make the stream emit an error
     // complaining.
-    StreamSubscription<T> subscription;
+    StreamSubscription<dynamic> subscription;
     subscription = receivePort.listen((message) {
       if (message is SendPort) {
         var controller = new StreamChannelController<T>(
             allowForeignErrors: false, sync: true);
-        new SubscriptionStream(subscription).pipe(controller.local.sink);
+        new SubscriptionStream(subscription)
+            .cast<T>()
+            .pipe(controller.local.sink);
         controller.local.stream
             .listen((data) => message.send(data), onDone: receivePort.close);
 
@@ -93,7 +95,7 @@
   factory IsolateChannel(ReceivePort receivePort, SendPort sendPort) {
     var controller =
         new StreamChannelController<T>(allowForeignErrors: false, sync: true);
-    receivePort.pipe(controller.local.sink);
+    receivePort.cast<T>().pipe(controller.local.sink);
     controller.local.stream
         .listen((data) => sendPort.send(data), onDone: receivePort.close);
     return new IsolateChannel._(
diff --git a/pubspec.yaml b/pubspec.yaml
index ff2209c..54bd972 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: stream_channel
-version: 1.6.7
+version: 1.6.7+1
 description: An abstraction for two-way communication channels.
 author: Dart Team <misc@dartlang.org>
 homepage: https://github.com/dart-lang/stream_channel
diff --git a/test/isolate_channel_test.dart b/test/isolate_channel_test.dart
index 00f4584..4c73ab0 100644
--- a/test/isolate_channel_test.dart
+++ b/test/isolate_channel_test.dart
@@ -136,8 +136,8 @@
     });
 
     test("create a connected pair of channels", () {
-      var channel1 = new IsolateChannel.connectReceive(connectPort);
-      var channel2 = new IsolateChannel.connectSend(connectPort.sendPort);
+      var channel1 = new IsolateChannel<int>.connectReceive(connectPort);
+      var channel2 = new IsolateChannel<int>.connectSend(connectPort.sendPort);
 
       channel1.sink.add(1);
       channel1.sink.add(2);