OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 @TestOn('vm') | 5 @TestOn('vm') |
6 | 6 |
7 library http_parser.web_socket_test; | |
8 | |
9 import 'dart:io'; | 7 import 'dart:io'; |
10 | 8 |
11 import 'package:http_parser/http_parser.dart'; | 9 import 'package:http_parser/http_parser.dart'; |
12 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
13 | 11 |
14 void main() { | 12 void main() { |
15 test("a client can communicate with a WebSocket server", () { | 13 test("a client can communicate with a WebSocket server", () { |
16 return HttpServer.bind("localhost", 0).then((server) { | 14 return HttpServer.bind("localhost", 0).then((server) { |
17 server.transform(new WebSocketTransformer()).listen((webSocket) { | 15 server.transform(new WebSocketTransformer()).listen((webSocket) { |
18 webSocket.add("hello!"); | 16 webSocket.add("hello!"); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 server.close(); | 88 server.close(); |
91 } else { | 89 } else { |
92 fail("Only expected two messages."); | 90 fail("Only expected two messages."); |
93 } | 91 } |
94 n++; | 92 n++; |
95 }).asFuture(); | 93 }).asFuture(); |
96 }); | 94 }); |
97 }); | 95 }); |
98 }); | 96 }); |
99 } | 97 } |
OLD | NEW |