()
| 126 | } |
| 127 | |
| 128 | public async stop(): Promise<void> { |
| 129 | return new Promise((resolve) => { |
| 130 | if (!this.isRunning) { |
| 131 | resolve(); |
| 132 | return; |
| 133 | } |
| 134 | |
| 135 | Array.from(this.connections.keys()).forEach((connectionId) => { |
| 136 | this.closeConnection(connectionId); |
| 137 | }); |
| 138 | |
| 139 | this.server.close(() => { |
| 140 | this.isRunning = false; |
| 141 | this.log('Proxy server stopped'); |
| 142 | this.emit('close'); |
| 143 | resolve(); |
| 144 | }); |
| 145 | }); |
| 146 | } |
| 147 | |
| 148 | private makeInterceptor(description: InterceptorDescription): Interceptor { |
| 149 | const { name, fn, matchLimit } = description; |
no test coverage detected