blob: 50c1cd5c687c0ec55bebc6596d6469dd5e97af6c [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);
}