  { run: mustCall(function(msg, next) {
      const state = {
        readies: 0,
        closes: 0
      };
      const clientCfg = {
        username: USER,
        password: PASSWORD
      };
      const serverCfg = {
        hostKeys: [HOST_KEY_RSA]
      };
      let reconnect = false;
      const client = new Client();
      const server = new Server(serverCfg);

      function onReady() {
        assert(++state.readies <= 4,
               msg(`Wrong ready count: ${state.readies}`));
      }

      function onClose() {
        assert(++state.closes <= 3,
               msg(`Wrong close count: ${state.closes}`));
        if (state.closes === 2)
          server.close();
        else if (state.closes === 3)
          next();
      }

      server.listen(0, 'localhost', mustCall(() => {
        clientCfg.host = 'localhost';
        clientCfg.port = server.address().port;
        client.connect(clientCfg);
      }));

      server.on('connection', mustCall((conn) => {
        conn.on('authentication', mustCall((ctx) => {
          ctx.accept();
        })).on('ready', onReady);
      })).on('close', onClose);
      client.on('ready', mustCall(() => {
        onReady();
        if (reconnect) {
          client.end();
        } else {
          reconnect = true;
          client.connect(clientCfg);
        }
      })).on('close', onClose);
    }),
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.