Fix sendToServer function.
Fix sendToServer function.

Security server closes connection when protocol is broken.
Client was not able to handle this situation.

[Issue#]   N/A
[Bug]      Client program may hang.
[Cause]    sendToServer function does not support
           situation when read returns 0.
[Problem]  N/A
[Solution] N/A

[Verification] Run tests.

Change-Id: Ie3002ae88c6ac4b55958b4e0d2d81ca5aacd5c43

pohly/security-manager,Samsung/security-manager,Samsung/security-manager,Samsung/security-manager,pohly/security-manager,pohly/security-manager