OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 SecureSocket socket; | 101 SecureSocket socket; |
102 String reply; | 102 String reply; |
103 } | 103 } |
104 | 104 |
105 Function EndTest; | 105 Function EndTest; |
106 | 106 |
107 const CLIENT_NAMES = const ['able', 'baker']; | 107 const CLIENT_NAMES = const ['able', 'baker']; |
108 | 108 |
109 void main() { | 109 void main() { |
110 ReceivePort keepAlive = new ReceivePort(); | 110 ReceivePort keepAlive = new ReceivePort(); |
111 Path scriptDir = new Path.fromNative(new Options().script).directoryPath; | 111 Path scriptDir = new Path(new Options().script).directoryPath; |
112 Path certificateDatabase = scriptDir.append('pkcert'); | 112 Path certificateDatabase = scriptDir.append('pkcert'); |
113 SecureSocket.initialize(database: certificateDatabase.toNativePath(), | 113 SecureSocket.initialize(database: certificateDatabase.toNativePath(), |
114 password: 'dartdart', | 114 password: 'dartdart', |
115 useBuiltinRoots: false); | 115 useBuiltinRoots: false); |
116 | 116 |
117 var server = new SecureTestServer(); | 117 var server = new SecureTestServer(); |
118 int port = server.start(); | 118 int port = server.start(); |
119 | 119 |
120 EndTest = () { | 120 EndTest = () { |
121 Expect.equals(CLIENT_NAMES.length, server.numConnections); | 121 Expect.equals(CLIENT_NAMES.length, server.numConnections); |
122 server.stop(); | 122 server.stop(); |
123 keepAlive.close(); | 123 keepAlive.close(); |
124 }; | 124 }; |
125 | 125 |
126 int delay = 0; | 126 int delay = 0; |
127 int delay_between_connections = 300; // Milliseconds. | 127 int delay_between_connections = 300; // Milliseconds. |
128 | 128 |
129 for (var x in CLIENT_NAMES) { | 129 for (var x in CLIENT_NAMES) { |
130 new Timer(delay, (_) { | 130 new Timer(delay, (_) { |
131 new SecureTestClient(port, x); | 131 new SecureTestClient(port, x); |
132 }); | 132 }); |
133 delay += delay_between_connections; | 133 delay += delay_between_connections; |
134 } | 134 } |
135 } | 135 } |
OLD | NEW |