Avoid NPE on closing un-connected socket.
Fix Thread.getState().