Similar to the case of the stateful inspection model, the firewall builds a dynamic table. Packets are inspected according to the table. From a security standpoint, the most secure firewall is a standard proxying firewall, where all traffic is inspected on an application layer. However, that isn't always the most practical solution. A strictly proxy environment is slow and difficult to maintain.
Proxies have to be written for new applications as they come out.
An adaptive proxy, using a combination of proxying and packet filtering, is far more likely to be encountered.