package com.android.dialer.helpdesk.http; /** * Integration check for {@link HelpdeskHttpClient} against the running backend prototype (started by * tests/integration.sh). Proves the full device→backend auth path end-to-end: a correctly-signed * webhook is accepted (200), a wrong secret or wrong token is rejected (401). */ public class HelpdeskHttpClientIT { public static void main(String[] args) { String base = args.length > 0 ? args[0] : "http://localhost:4000/api/v1"; String body = "{\"call_id\":\"it-" + System.nanoTime() + "\",\"ts\":\"2026-07-08T10:00:00Z\"," + "\"number\":\"+420601234567\",\"presentation\":\"allowed\"," + "\"dialed_did\":\"+420800111222\",\"device_id\":\"it-device\"}"; HelpdeskHttpClient good = new HelpdeskHttpClient(base, new DeviceAuthSigner("dev-device-token", "dev-device-secret")); System.out.println("VALID_STATUS=" + good.send("POST", "/calls/incoming", body).status); HelpdeskHttpClient wrongSecret = new HelpdeskHttpClient(base, new DeviceAuthSigner("dev-device-token", "WRONG-secret")); System.out.println("TAMPERED_STATUS=" + wrongSecret.send("POST", "/calls/incoming", body).status); HelpdeskHttpClient wrongToken = new HelpdeskHttpClient(base, new DeviceAuthSigner("WRONG-token", "dev-device-secret")); System.out.println("BADTOKEN_STATUS=" + wrongToken.send("POST", "/calls/incoming", body).status); } }