| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import "package:unittest/unittest.dart"; | 8 import "package:unittest/unittest.dart"; |
| 9 import "package:http_server/http_server.dart"; | 9 import "package:http_server/http_server.dart"; |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 getStatusCode(server.port, '/', host: 'my.host1.com'), | 59 getStatusCode(server.port, '/', host: 'my.host1.com'), |
| 60 getStatusCode(server.port, '/', host: 'my.host2.com'), | 60 getStatusCode(server.port, '/', host: 'my.host2.com'), |
| 61 getStatusCode(server.port, '/', host: 'my.host3.com')]) | 61 getStatusCode(server.port, '/', host: 'my.host3.com')]) |
| 62 .whenComplete(server.close); | 62 .whenComplete(server.close); |
| 63 }), completion(equals([HttpStatus.OK, HttpStatus.OK, HttpStatus.OK]))); | 63 }), completion(equals([HttpStatus.OK, HttpStatus.OK, HttpStatus.OK]))); |
| 64 }); | 64 }); |
| 65 | 65 |
| 66 test('multiple-source-https', () { | 66 test('multiple-source-https', () { |
| 67 expect(Future.wait([ | 67 expect(Future.wait([ |
| 68 HttpServer.bind('localhost', 0), | 68 HttpServer.bind('localhost', 0), |
| 69 HttpServer.bindSecure('localhost', 0, certificateName: CERTIFICATE)]) | 69 HttpServer.bindSecure('localhost', 0, serverContext)]) |
| 70 .then((servers) { | 70 .then((servers) { |
| 71 var virHost = new VirtualHost(); | 71 var virHost = new VirtualHost(); |
| 72 virHost.addSource(servers[0]); | 72 virHost.addSource(servers[0]); |
| 73 virHost.addSource(servers[1]); | 73 virHost.addSource(servers[1]); |
| 74 virHost.unhandled.listen((request) { | 74 virHost.unhandled.listen((request) { |
| 75 request.response.close(); | 75 request.response.close(); |
| 76 }); | 76 }); |
| 77 return Future.wait([ | 77 return Future.wait([ |
| 78 getStatusCode(servers[0].port, '/', host: 'myhost1.com'), | 78 getStatusCode(servers[0].port, '/', host: 'myhost1.com'), |
| 79 getStatusCode( | 79 getStatusCode( |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 expect(() => (virHost.addHost('*.host.com')), throwsArgumentError); | 172 expect(() => (virHost.addHost('*.host.com')), throwsArgumentError); |
| 173 virHost.addHost('my2.host.com'); | 173 virHost.addHost('my2.host.com'); |
| 174 virHost.addHost('my3.host.com'); | 174 virHost.addHost('my3.host.com'); |
| 175 virHost.addHost('*.com'); | 175 virHost.addHost('*.com'); |
| 176 virHost.addHost('*'); | 176 virHost.addHost('*'); |
| 177 expect(() => (virHost.addHost('*')), throwsArgumentError); | 177 expect(() => (virHost.addHost('*')), throwsArgumentError); |
| 178 }); | 178 }); |
| 179 }); | 179 }); |
| 180 } | 180 } |
| 181 | 181 |
| OLD | NEW |