blob: b01b8bef11e6663e7fc18fdb1bb7965cf7ee20f9 [file] [log] [blame]
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/**
* @assertion bool requireClientCertificate
* final
*
* @description Checks that property requireClientCertificate returns true, if
* the corresponding parameter of bind method was set to true.
* @author ngl@unipro.ru
*/
import "dart:io";
import "../../../Utils/expect.dart";
check(InternetAddress address) {
asyncStart();
SecurityContext sc = new SecurityContext(withTrustedRoots: true);
RawSecureServerSocket
.bind(address, 0, sc, requireClientCertificate: true)
.then((server) {
Expect.isTrue(server.requireClientCertificate);
server.close();
asyncEnd();
});
}
main() {
check(InternetAddress.anyIPv4);
check(InternetAddress.anyIPv6);
check(InternetAddress.loopbackIPv4);
check(InternetAddress.loopbackIPv6);
}