Some OptionalConnection work.

Deprecate getConnection, fix CustomWindow's getOptionalConnection
returning null, change a couple of usages.
Merge pull request #127 from csmith/master

Some OptionalConnection work.