blob: f42010468703e3e8cad4cd2e1989fd277f6d98ce [file] [log] [blame]
// Copyright (c) 2017, 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 String closeReason
/// The close reason set when the WebSocket connection is closed. If there is no
/// close reason available this property will be null
/// @description Checks that the [closeReason] is null when connection is not
/// closed and is set to an empty string value if the WebSocket connection is
/// closed.
/// @author
import "dart:io";
import "../../../Utils/expect.dart";
main() {
HttpServer.bind("", 0).then((server) {
server.listen((request) {
.then((websocket) {
var webs = WebSocket.connect("ws://${server.port}/");
webs.then((WebSocket client) async {
await server.close();
client.close().then((_) {
Expect.equals("", client.closeReason);