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 // VMOptions= | 5 // VMOptions= |
6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
9 | 9 |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 response.contentLength = 0; | 55 response.contentLength = 0; |
56 response.close(); | 56 response.close(); |
57 Expect.throws(response.detachSocket); | 57 Expect.throws(response.detachSocket); |
58 server.close(); | 58 server.close(); |
59 }); | 59 }); |
60 | 60 |
61 Socket.connect("127.0.0.1", server.port).then((socket) { | 61 Socket.connect("127.0.0.1", server.port).then((socket) { |
62 socket.write("GET / HTTP/1.1\r\n" | 62 socket.write("GET / HTTP/1.1\r\n" |
63 "content-length: 0\r\n\r\n"); | 63 "content-length: 0\r\n\r\n"); |
64 socket.listen((_) {}, onDone: () { | 64 socket.listen((_) {}, onDone: () { |
65 socket.close(); | 65 socket.close(); |
66 }); | 66 }); |
67 }); | 67 }); |
68 }); | 68 }); |
69 } | 69 } |
70 | 70 |
71 void testClientDetachSocket() { | 71 void testClientDetachSocket() { |
72 ServerSocket.bind("127.0.0.1", 0).then((server) { | 72 ServerSocket.bind("127.0.0.1", 0).then((server) { |
73 server.listen((socket) { | 73 server.listen((socket) { |
74 socket.write("HTTP/1.1 200 OK\r\n" | 74 socket.write("HTTP/1.1 200 OK\r\n" |
75 "\r\n" | 75 "\r\n" |
76 "Test!"); | 76 "Test!"); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 }); | 111 }); |
112 }); | 112 }); |
113 }); | 113 }); |
114 } | 114 } |
115 | 115 |
116 void main() { | 116 void main() { |
117 testServerDetachSocket(); | 117 testServerDetachSocket(); |
118 testBadServerDetachSocket(); | 118 testBadServerDetachSocket(); |
119 testClientDetachSocket(); | 119 testClientDetachSocket(); |
120 } | 120 } |
OLD | NEW |