Fixes #4129
Actually test the connection
Update file to meet coding standarts
Merge pull request #4662 from owncloud/fix-4129

Fix 4129