function createAiResponseServer() {
  const server = http.createServer(handler)
  const sockets = new Set()

  server.on('connection', (socket) => {
    sockets.add(socket)
    socket.once('close', () => sockets.delete(socket))
  })
  server.destroy = function destroy() {
    sockets.forEach((s) => s.destroy())
    server.close()
  }

  return new Promise((resolve, reject) => {
    server.listen({ host: '127.0.0.1', port: 0 }, (error) => {
      if (error) {
        return reject(error)
      }

      const addy = server.address()
      return resolve({
        server,
        host: addy.address,
        port: addy.port,
        baseUrl: `http://${addy.address}:${addy.port}`,
        responses
      })
    })
  })
}
Creates a new HTTP server to serve responses for Amazon AI requests
(i.e. the Bedrock API). The returned server is listening on `localhost`
and a random port.

@returns {Promise<object>} Has `server`, `host`, `port`, `baseUrl`,
and `responses` properties.