| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import "dart:math"; | 8 import "dart:math"; |
| 9 | 9 |
| 10 import "package:async_helper/async_helper.dart"; | 10 import "package:async_helper/async_helper.dart"; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 390 |
| 391 // Close the socket for reading, do a write, and see if we can get any | 391 // Close the socket for reading, do a write, and see if we can get any |
| 392 // response from the server (we shouldn't be able to). | 392 // response from the server (we shouldn't be able to). |
| 393 socket = RawSynchronousSocket.connectSync( | 393 socket = RawSynchronousSocket.connectSync( |
| 394 LOOPBACK_IP_V4_STRING, serverInternetPort); | 394 LOOPBACK_IP_V4_STRING, serverInternetPort); |
| 395 socket.shutdown(SocketDirection.RECEIVE); | 395 socket.shutdown(SocketDirection.RECEIVE); |
| 396 socket.writeFromSync(data); | 396 socket.writeFromSync(data); |
| 397 // Throws exception when the socket is closed for RECEIVE. | 397 // Throws exception when the socket is closed for RECEIVE. |
| 398 Expect.throws( | 398 Expect.throws( |
| 399 () => socket.readSync(data.length), (e) => e is SocketException); | 399 () => socket.readSync(data.length), (e) => e is SocketException); |
| 400 Expect.isTrue(socket.available() == 0); | |
| 401 socket.closeSync(); | 400 socket.closeSync(); |
| 402 | 401 |
| 403 // Close the socket for writing and try to do a write. This should cause an | 402 // Close the socket for writing and try to do a write. This should cause an |
| 404 // OSError to be throw as the pipe is closed for writing. | 403 // OSError to be throw as the pipe is closed for writing. |
| 405 socket = RawSynchronousSocket.connectSync( | 404 socket = RawSynchronousSocket.connectSync( |
| 406 LOOPBACK_IP_V4_STRING, serverInternetPort); | 405 LOOPBACK_IP_V4_STRING, serverInternetPort); |
| 407 socket.shutdown(SocketDirection.SEND); | 406 socket.shutdown(SocketDirection.SEND); |
| 408 Expect.throws( | 407 Expect.throws( |
| 409 () => socket.writeFromSync(data), (e) => e is SocketException); | 408 () => socket.writeFromSync(data), (e) => e is SocketException); |
| 410 socket.closeSync(); | 409 socket.closeSync(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 await testShutdown(); | 481 await testShutdown(); |
| 483 testSimpleConnect(); | 482 testSimpleConnect(); |
| 484 testServerListenAfterConnect(); | 483 testServerListenAfterConnect(); |
| 485 await testSimpleReadWrite(); | 484 await testSimpleReadWrite(); |
| 486 await testPartialRead(); | 485 await testPartialRead(); |
| 487 await testPartialWrite(); | 486 await testPartialWrite(); |
| 488 testInvalidReadWriteOperations(); | 487 testInvalidReadWriteOperations(); |
| 489 testClosedError(); | 488 testClosedError(); |
| 490 asyncEnd(); | 489 asyncEnd(); |
| 491 } | 490 } |
| OLD | NEW |