Connection and Trailing Spaces

* Removed trailing spaces of files
* Change connection status. If connection failed, the client must be closed
* Reconnect if an error occurs
Merge pull request #5 from fabiorphp/master

Connection and Trailing Spaces