/// /// import http from "http"; import { Socket } from "net"; import { Application } from "express"; export type ServerDeps = { port: number; app: Application; log: (msg: string) => void; onError: (error: unknown) => void; onOpen: () => void; onClose: () => void; }; /** * hacky - only used for testing. */ export declare class Server { private deps; server: http.Server; sockets: Set; protected state: "opening" | "running" | "stopping" | "stopped"; private waitingForSocketsToClose; private shutdownListener?; /** * */ constructor(deps: ServerDeps); getState: () => "opening" | "running" | "stopping" | "stopped"; /** * should wait for conformation */ killIfRunning: () => Promise; /** * */ shutdown: () => Promise; /** * */ private shutdownReal; /** * */ private onServerClose; /** * */ private onSocketClose; /** * */ private onActualClose; }