What program are you using to connect to your server? What URL are you using?

The call to close() will close the connection before any communications take place.

The catch() block should have...