Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: tests/standalone/io/http_server_idle_timeout_test.dart

Issue 22839013: Add HttpServer.idleTimeout for closing idle keep-alive connections. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 //
5 // VMOptions=
6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write
9
10 import "package:expect/expect.dart";
11 import "dart:async";
12 import "dart:io";
13 import "dart:isolate";
14
15
16 void testTimeoutAfterRequest() {
17 HttpServer.bind("127.0.0.1", 0).then((server) {
18 server.idleTimeout = const Duration(milliseconds: 100);
19
20 server.listen((request) => request.response.close());
21
22 Socket.connect("127.0.0.1", server.port).then((socket) {
23 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n";
24 socket.write(data);
25 socket.listen(
26 null,
27 onDone: () {
28 socket.close();
29 server.close();
30 });
31 });
32 });
33 }
34
35 void testTimeoutBeforeRequest() {
36 HttpServer.bind("127.0.0.1", 0).then((server) {
37 server.idleTimeout = const Duration(milliseconds: 100);
38
39 server.listen((request) => request.response.close());
40
41 Socket.connect("127.0.0.1", server.port).then((socket) {
42 socket.listen(
43 null,
44 onDone: () {
45 socket.close();
46 server.close();
47 });
48 });
49 });
50 }
51
52 void main() {
53 testTimeoutAfterRequest();
54 testTimeoutBeforeRequest();
55 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698