[#1770] Fix NPE which was thrown if connection timeout was disabled and the connect did not finish directly when using NIO
Merge remote-tracking branch: upstream/master