Various copypasta and typing errors around the thunks, some other copypasta errors, etc. Also add a test which hits a decent chunk of the API surface of ConnectionOptions, which is how these issues were caught in the first place. This is an ugly test, but it has clearly served its purpose.