| 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 verifies that client certificates work, if the client and server | 5 // This test verifies that client certificates work, if the client and server |
| 6 // are in separate processes, and that connection renegotiation works, and | 6 // are in separate processes, and that connection renegotiation works, and |
| 7 // can request a client certificate to be sent. | 7 // can request a client certificate to be sent. |
| 8 | 8 |
| 9 import "dart:async"; | 9 import "dart:async"; |
| 10 import "dart:convert"; | 10 import "dart:convert"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 Future<SecureServerSocket> runServer() { | 23 Future<SecureServerSocket> runServer() { |
| 24 SecureSocket.initialize(database: certificateDatabase(), | 24 SecureSocket.initialize(database: certificateDatabase(), |
| 25 password: 'dartdart'); | 25 password: 'dartdart'); |
| 26 | 26 |
| 27 return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE) | 27 return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE) |
| 28 .then((SecureServerSocket server) { | 28 .then((SecureServerSocket server) { |
| 29 server.listen((SecureSocket socket) { | 29 server.listen((SecureSocket socket) { |
| 30 Expect.isNull(socket.peerCertificate); | 30 Expect.isNull(socket.peerCertificate); |
| 31 | 31 |
| 32 StreamIterator<String> input = | 32 StreamIterator<String> input = |
| 33 new StreamIterator(socket.transform(new StringDecoder()) | 33 new StreamIterator(socket.transform(UTF8.decoder) |
| 34 .transform(new LineSplitter())); | 34 .transform(new LineSplitter())); |
| 35 input.moveNext().then((success) { | 35 input.moveNext().then((success) { |
| 36 Expect.isTrue(success); | 36 Expect.isTrue(success); |
| 37 Expect.equals('first', input.current); | 37 Expect.equals('first', input.current); |
| 38 socket.writeln('first reply'); | 38 socket.writeln('first reply'); |
| 39 return input.moveNext(); | 39 return input.moveNext(); |
| 40 }).then((success) { | 40 }).then((success) { |
| 41 Expect.isTrue(success); | 41 Expect.isTrue(success); |
| 42 Expect.equals('renegotiated', input.current); | 42 Expect.equals('renegotiated', input.current); |
| 43 Expect.isNull(socket.peerCertificate); | 43 Expect.isNull(socket.peerCertificate); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (result.exitCode != 0) { | 77 if (result.exitCode != 0) { |
| 78 print("Client failed, stdout:"); | 78 print("Client failed, stdout:"); |
| 79 print(result.stdout); | 79 print(result.stdout); |
| 80 print(" stderr:"); | 80 print(" stderr:"); |
| 81 print(result.stderr); | 81 print(result.stderr); |
| 82 Expect.fail('Client subprocess exit code: ${result.exitCode}'); | 82 Expect.fail('Client subprocess exit code: ${result.exitCode}'); |
| 83 } | 83 } |
| 84 }); | 84 }); |
| 85 }); | 85 }); |
| 86 } | 86 } |
| OLD | NEW |