Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .lastmerge
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e40d57c86e18b495722adbf42045288c03924342
304d812cd4c98755159da427c6701bfb7e0b7c32
22 changes: 22 additions & 0 deletions src/test/java/com/github/copilot/sdk/CopilotClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,28 @@ void testForceStopWithNoConnectionCompletes() throws Exception {
}
}

@Test
void testCloseSessionAfterStoppingClientDoesNotThrow() throws Exception {
if (cliPath == null) {
System.out.println("Skipping test: CLI not found");
return;
}

try (var client = new CopilotClient(new CopilotClientOptions().setCliPath(cliPath))) {
var session = client.createSession().get();

// Stop the client first (which closes the RPC connection)
client.stop().get();

// Then close the session - should not throw even though RPC is closed
assertDoesNotThrow(() -> session.close(), "Closing session after client.stop() should not throw exception");

// Verify session is terminated
assertThrows(IllegalStateException.class, () -> session.send("test"),
"Session should be terminated after close()");
}
}

// ===== start() idempotency =====

@Test
Expand Down
Loading