Add close operation to 'StateConnecting' for interrupting a connecting socket.
Add timer cancel function.