| OLD | NEW |
| (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 import "dart:io"; |
| 6 import "dart:uri"; |
| 7 |
| 8 void main() { |
| 9 final int REQUEST_COUNT = 100; |
| 10 int count = 0; |
| 11 HttpServer.bind().then((server) { |
| 12 server.listen((HttpRequest request) { |
| 13 count++; |
| 14 request.response.addString(request.uri.path); |
| 15 request.response.close(); |
| 16 if (request.uri.path == "/done") { |
| 17 request.response.done.then((_) { |
| 18 Expect.equals(REQUEST_COUNT + 1, count); |
| 19 server.close(); |
| 20 }); |
| 21 } |
| 22 }); |
| 23 Socket.connect("127.0.0.1", server.port).then((s) { |
| 24 s.listen((data) { }); |
| 25 for (int i = 0; i < REQUEST_COUNT; i++) { |
| 26 s.addString("GET /$i HTTP/1.1\r\nX-Header-1: 111\r\n\r\n"); |
| 27 } |
| 28 s.addString("GET /done HTTP/1.1\r\nConnection: close\r\n\r\n"); |
| 29 s.close(); |
| 30 }); |
| 31 }); |
| 32 } |
| OLD | NEW |