OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // This test checks that setting writeEventsEnabled on a socket that is | 5 // This test checks that setting writeEventsEnabled on a socket that is |
6 // closed for read (the other end has closed for write) does not send | 6 // closed for read (the other end has closed for write) does not send |
7 // an additional READ_CLOSED event. | 7 // an additional READ_CLOSED event. |
8 | 8 |
9 import "dart:io"; | 9 import "dart:io"; |
10 import "dart:async"; | 10 import "dart:async"; |
(...skipping 23 matching lines...) Expand all Loading... |
34 server.close(); | 34 server.close(); |
35 }); | 35 }); |
36 } | 36 } |
37 break; | 37 break; |
38 case RawSocketEvent.READ_CLOSED: | 38 case RawSocketEvent.READ_CLOSED: |
39 Expect.isFalse(serverReadClosedReceived); | 39 Expect.isFalse(serverReadClosedReceived); |
40 serverReadClosedReceived = true; | 40 serverReadClosedReceived = true; |
41 break; | 41 break; |
42 } | 42 } |
43 } | 43 } |
| 44 |
44 serverSide.listen(serveData); | 45 serverSide.listen(serveData); |
45 } | 46 } |
46 | 47 |
47 | |
48 test() async { | 48 test() async { |
49 server = await RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0); | 49 server = await RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0); |
50 server.listen(serverListen); | 50 server.listen(serverListen); |
51 client = await RawSocket.connect(InternetAddress.LOOPBACK_IP_V4, server.port); | 51 client = await RawSocket.connect(InternetAddress.LOOPBACK_IP_V4, server.port); |
52 client.shutdown(SocketDirection.SEND); | 52 client.shutdown(SocketDirection.SEND); |
53 client.listen((RawSocketEvent event) { | 53 client.listen((RawSocketEvent event) { |
54 if (event == RawSocketEvent.READ) { | 54 if (event == RawSocketEvent.READ) { |
55 client.read(); | 55 client.read(); |
56 } | 56 } |
57 }); | 57 }); |
58 } | 58 } |
59 | 59 |
60 | |
61 void main() { | 60 void main() { |
62 test(); | 61 test(); |
63 } | 62 } |
OLD | NEW |