Detect read-only connections.

Also fixed some checkstyle violations.

Closes #10