blob: 4d2f083b74d71aea46b1db2ef19bc6e831ea0b25 [file] [log] [blame]
// Copyright (c) 2021, 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.
// Verify that socket connection gracefully closes if cancelled.
import 'dart:async';
import 'dart:io';
import 'package:expect/expect.dart';
void main() async {
final task = await Socket.startConnect('', 80);
try {
await task.socket;
} catch (e) {
Expect.isTrue(e is SocketException);
final socketException = e as SocketException;
socketException.message.startsWith('Connection attempt cancelled'));