-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from cbenhagen/fix/116-channel-close
fix: Close channel correctly when receiving SSH_Message_Channel_Close
- Loading branch information
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'package:dartssh2/dartssh2.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
import '../../test_utils.dart'; | ||
|
||
void main() { | ||
group('SSHChannel', () { | ||
late SSHClient client; | ||
late SSHSession session; | ||
|
||
setUp(() async { | ||
client = await getTestClient(); | ||
await client.authenticated; | ||
session = await client.shell(); | ||
}); | ||
|
||
tearDown(() { | ||
client.close(); | ||
}); | ||
|
||
test('stdout stream handles remote channel close correctly', () async { | ||
final drainFuture = session.stdout.drain<void>(); | ||
|
||
final closeMessage = createChannelCloseMessage(0); | ||
client.handlePacket(closeMessage); | ||
|
||
await drainFuture; | ||
}, timeout: const Timeout(Duration(seconds: 1))); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters