MCPcopy Index your code
hub / github.com/github/copilot-sdk / isAlive

Method isAlive

java/src/test/java/com/github/copilot/CapiProxy.java:439–462  ·  view source on GitHub ↗

Checks if the proxy process is still alive and responsive. This does both a process alive check AND an HTTP health check. @return true if the proxy is running and responsive, false otherwise

()

Source from the content-addressed store, hash-verified

437 * @return true if the proxy is running and responsive, false otherwise
438 */
439 public boolean isAlive() {
440 if (process == null || !process.isAlive()) {
441 return false;
442 }
443
444 // Also verify the proxy is responsive via HTTP
445 if (proxyUrl != null) {
446 try {
447 java.net.HttpURLConnection conn = (java.net.HttpURLConnection) new java.net.URL(proxyUrl + "/exchanges")
448 .openConnection();
449 conn.setRequestMethod("GET");
450 conn.setConnectTimeout(1000);
451 conn.setReadTimeout(1000);
452 int responseCode = conn.getResponseCode();
453 conn.disconnect();
454 return responseCode == 200;
455 } catch (Exception e) {
456 // If HTTP check fails, the proxy is not responsive
457 return false;
458 }
459 }
460
461 return true;
462 }
463
464 /**
465 * Restarts the proxy server. This stops the current instance (if any) and

Calls 1

disconnectMethod · 0.45

Tested by

no test coverage detected