Fixes crash calling setSecure on a socket not yet connected.

Calling setSecure on a socket that isn't connected yet causes
a nasty crash. This commit adds a check and issues a Lua error
instead.

fixes #16