| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "dart:async"; | 5 import "dart:async"; |
| 6 import "dart:io"; | 6 import "dart:io"; |
| 7 import "dart:isolate"; | 7 import "dart:isolate"; |
| 8 | 8 |
| 9 void sendData(List<int> data, int port) { | 9 void sendData(List<int> data, int port) { |
| 10 Socket.connect("127.0.0.1", port).then((socket) { | 10 Socket.connect("127.0.0.1", port).then((socket) { |
| 11 socket.listen((data) { | 11 socket.listen((data) { |
| 12 Expect.fail("No data response was expected"); | 12 Expect.fail("No data response was expected"); |
| 13 }); | 13 }); |
| 14 socket.add(data); | 14 socket.writeBytes(data); |
| 15 socket.close(); | 15 socket.close(); |
| 16 socket.done.then((_) { | 16 socket.done.then((_) { |
| 17 socket.destroy(); | 17 socket.destroy(); |
| 18 }); | 18 }); |
| 19 }); | 19 }); |
| 20 } | 20 } |
| 21 | 21 |
| 22 class EarlyCloseTest { | 22 class EarlyCloseTest { |
| 23 EarlyCloseTest(this.data, | 23 EarlyCloseTest(this.data, |
| 24 String this.exception, | 24 String this.exception, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 }); | 130 }); |
| 131 } | 131 } |
| 132 makeRequest(); | 132 makeRequest(); |
| 133 }); | 133 }); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void main() { | 136 void main() { |
| 137 testEarlyClose1(); | 137 testEarlyClose1(); |
| 138 // testEarlyClose2(); | 138 // testEarlyClose2(); |
| 139 } | 139 } |
| OLD | NEW |