Set timeout on socket before handshake.