File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
src/test/java/com/github/copilot/sdk Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1- e40d57c86e18b495722adbf42045288c03924342
1+ 304d812cd4c98755159da427c6701bfb7e0b7c32
Original file line number Diff line number Diff line change @@ -424,6 +424,28 @@ void testForceStopWithNoConnectionCompletes() throws Exception {
424424 }
425425 }
426426
427+ @ Test
428+ void testCloseSessionAfterStoppingClientDoesNotThrow () throws Exception {
429+ if (cliPath == null ) {
430+ System .out .println ("Skipping test: CLI not found" );
431+ return ;
432+ }
433+
434+ try (var client = new CopilotClient (new CopilotClientOptions ().setCliPath (cliPath ))) {
435+ var session = client .createSession ().get ();
436+
437+ // Stop the client first (which closes the RPC connection)
438+ client .stop ().get ();
439+
440+ // Then close the session - should not throw even though RPC is closed
441+ assertDoesNotThrow (() -> session .close (), "Closing session after client.stop() should not throw exception" );
442+
443+ // Verify session is terminated
444+ assertThrows (IllegalStateException .class , () -> session .send ("test" ),
445+ "Session should be terminated after close()" );
446+ }
447+ }
448+
427449 // ===== start() idempotency =====
428450
429451 @ Test
You can’t perform that action at this time.
0 commit comments