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 // This test tests TLS session resume, by making multiple client connections | 5 // This test tests TLS session resume, by making multiple client connections |
6 // on the same port to the same server, with a delay of 200 ms between them. | 6 // on the same port to the same server, with a delay of 200 ms between them. |
7 // The unmodified secure_server_test creates all sessions simultaneously, | 7 // The unmodified secure_server_test creates all sessions simultaneously, |
8 // which means that no handshake completes and caches its keys in the session | 8 // which means that no handshake completes and caches its keys in the session |
9 // cache in time for other connections to use it. | 9 // cache in time for other connections to use it. |
10 // | 10 // |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 socket.close(); | 47 socket.close(); |
48 return socket.fold(<int>[], (message, data) => message..addAll(data)) | 48 return socket.fold(<int>[], (message, data) => message..addAll(data)) |
49 .then((message) { | 49 .then((message) { |
50 Expect.listEquals("Welcome, client $name".codeUnits, message); | 50 Expect.listEquals("Welcome, client $name".codeUnits, message); |
51 return server; | 51 return server; |
52 }); | 52 }); |
53 }); | 53 }); |
54 } | 54 } |
55 | 55 |
56 void main() { | 56 void main() { |
57 Path scriptDir = new Path(new Options().script).directoryPath; | 57 Path scriptDir = new Path(Platform.script).directoryPath; |
58 Path certificateDatabase = scriptDir.append('pkcert'); | 58 Path certificateDatabase = scriptDir.append('pkcert'); |
59 SecureSocket.initialize(database: certificateDatabase.toNativePath(), | 59 SecureSocket.initialize(database: certificateDatabase.toNativePath(), |
60 password: 'dartdart'); | 60 password: 'dartdart'); |
61 | 61 |
62 Duration delay = const Duration(milliseconds: 0); | 62 Duration delay = const Duration(milliseconds: 0); |
63 Duration delay_between_connections = const Duration(milliseconds: 300); | 63 Duration delay_between_connections = const Duration(milliseconds: 300); |
64 | 64 |
65 startServer() | 65 startServer() |
66 .then((server) => Future.wait( | 66 .then((server) => Future.wait( |
67 ['able', 'baker', 'charlie', 'dozen', 'elapse'] | 67 ['able', 'baker', 'charlie', 'dozen', 'elapse'] |
68 .map((name) { | 68 .map((name) { |
69 delay += delay_between_connections; | 69 delay += delay_between_connections; |
70 return new Future.delayed(delay, () => server) | 70 return new Future.delayed(delay, () => server) |
71 .then((server) => testClient(server, name)); | 71 .then((server) => testClient(server, name)); |
72 }))) | 72 }))) |
73 .then((servers) => servers.first.close()); | 73 .then((servers) => servers.first.close()); |
74 } | 74 } |
OLD | NEW |