Convert seconds to milliseconds for setTimeout + do not emit two errors when the handshake fails