blob: 2a940cfdf1e022d4f41b9ca62e2b8e2cb273eba0 [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 Future<RawSecureServerSocket> close()
* Closes the socket. The returned future completes when the socket is fully
* closed and is no longer bound.
*
* @description Checks that the returned future is completed with this.
* @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).then((server) {
server.close().then((value) {
Expect.equals(server, value);
}).whenComplete(() {
asyncEnd();
});
});
}
main() {
check(InternetAddress.anyIPv4);
check(InternetAddress.anyIPv6);
check(InternetAddress.loopbackIPv4);
check(InternetAddress.loopbackIPv6);
}