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

Unified Diff: tests/standalone/io/secure_multiple_client_server_test.dart

Issue 1319703002: Breaking Change: merge BoringSSL branch into master (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: tests/standalone/io/secure_multiple_client_server_test.dart
diff --git a/tests/standalone/io/secure_multiple_client_server_test.dart b/tests/standalone/io/secure_multiple_client_server_test.dart
index 2eeeed2cfb7580d3af0684946d0fd03ff096193d..586105d4a7425f24baaa8c8696355d9149b6b02e 100644
--- a/tests/standalone/io/secure_multiple_client_server_test.dart
+++ b/tests/standalone/io/secure_multiple_client_server_test.dart
@@ -15,10 +15,19 @@ import "package:expect/expect.dart";
InternetAddress HOST;
SecureServerSocket SERVER;
-const CERTIFICATE = "localhost_cert";
+
+String localFile(path) => Platform.script.resolve(path).toFilePath();
+
+SecurityContext serverContext = new SecurityContext()
+ ..useCertificateChain(localFile('certificates/server_chain.pem'))
+ ..usePrivateKey(localFile('certificates/server_key.pem'),
+ password: 'dartdart');
+
+SecurityContext clientContext = new SecurityContext()
+ ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'));
Future startServer() {
- return SecureServerSocket.bind(HOST, 0, CERTIFICATE).then((server) {
+ return SecureServerSocket.bind(HOST, 0, serverContext).then((server) {
SERVER = server;
SERVER.listen((SecureSocket client) {
client.fold(<int>[], (message, data) => message..addAll(data))
@@ -34,7 +43,8 @@ Future startServer() {
}
Future testClient(name) {
- return SecureSocket.connect(HOST, SERVER.port).then((socket) {
+ return SecureSocket.connect(HOST, SERVER.port, context: clientContext)
+ .then((socket) {
socket.add("Hello from client $name".codeUnits);
socket.close();
return socket.fold(<int>[], (message, data) => message..addAll(data))
@@ -46,9 +56,6 @@ Future testClient(name) {
void main() {
asyncStart();
- var certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
- SecureSocket.initialize(database: certificateDatabase,
- password: 'dartdart');
InternetAddress.lookup("localhost").then((hosts) => HOST = hosts.first)
.then((_) => startServer())
.then((_) => ['ale', 'bar', 'che', 'den', 'els'].map(testClient))
« no previous file with comments | « tests/standalone/io/secure_client_server_test.dart ('k') | tests/standalone/io/secure_server_client_certificate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698