Passes almost all tests. Throws some error when connection should be closed.