Sort of finished CAP support without SASL functionality, which will come in a forthcoming commit