modified server example to send connect response directly to client using writer object