Example usage code

This is a work in progress. It requires a connection to be established
beforehand, and has been tested by inclusion from a command-line script.