@PostConstruct
    public void init() {
        if (!environment.getAgentStatusEnabled()) {
            LOG.info("Agent status HTTP API server has been disabled.");
            return;
        }
        InetSocketAddress address = new InetSocketAddress(environment.getAgentStatusHostname(), environment.getAgentStatusPort());
        try {
            server = HttpServer.create(address, SERVER_SOCKET_BACKLOG);
            setupRoutes(server);
            server.start();
            LOG.info("Agent status HTTP API server running on http://{}:{}.", server.getAddress().getHostName(), server.getAddress().getPort());
        } catch (Exception e) {
            LOG.warn("Could not start agent status HTTP API server on host {}, port {}.", address.getHostName(), address.getPort(), e);
        }
    }
@Test
    void initShouldNotBlowUpIfServerDoesNotStart() {

        try (MockedStatic<HttpServer> mockedStaticHttpServer = mockStatic(HttpServer.class)) {
            setupAgentStatusParameters();

            var serverSocket = new InetSocketAddress(hostName, port);
            var spiedHttpServer = spy(HttpServer.class);
            doThrow(new RuntimeException("Server had a problem starting up!")).when(spiedHttpServer).start();

            mockedStaticHttpServer.when(() -> HttpServer.create(eq(serverSocket), anyInt())).thenReturn(spiedHttpServer);

            assertThatNoException().isThrownBy(() -> agentStatusHttpd.init());
        }
    }