This paper presents a new language called APSL for formally describing
protocols to facilitate automated testing. Many real world communication
protocols exchange messages whose structures are not trivial, e.g. they may
consist of multiple and nested fields, some could be optional, and some may
have values that depend on other fields. To properly test implementations of
such a protocol, it is not sufficient to only explore different orders of
sending and receiving messages. We also need to investigate if the
implementation indeed produces correctly formatted messages, and if it responds
correctly when it receives different variations of every message type. APSL's
main contribution is its sublanguage that is expressive enough to describe
complex message formats, both text-based and binary. As an example, this paper
also presents a case study where APSL is used to model and test a subset of
Courier IMAP email server