President Donald Trump is eager to crow about the economic weapon he wielded against Mexico to win concessions on immigration: “Tariffs are a great negotiating tool,” he declared Tuesday.

Now, Trump says, it’s China’s turn to cower. Yet to visit China these days is to encounter the limits of his punch-them-in-the-nose strategy. Even as Trump threatens to raise import duties to painful levels, 10 days of meetings with Chinese officials, academics, entrepreneurs and venture capitalists revealed a nation rewriting its relationship with the U.S. and preparing to ride out a trade war.

Trump is seeking to increase pressure on Xi Jinping, his Chinese counterpart, before this month’s G-20 summit, but Trump may already have pushed too far. Last month, Xi exhorted his countrymen to a second Long March, an echo of Mao’s seminal strategy to preserve the communist revolution. What Xi didn’t say was that the new march — this time in the service of China’s own model of capitalism — is already underway.

“This is definitely an inflection point,’’ said Tom Liu, chief executive officer of Shanghai-based data company ChinaScope Financial Ltd. ”People are seeing an indefinite trade shock.’’ And they are planning for it.

Silent Treatment

At Huawei Technologies Co., the telecom giant at the center of the clash, preparations are already on. The U.S. last month labeled Huawei a threat to U.S. national security and placed the company on an export blacklist cutting it off from suppliers such as Alphabet Inc.’s Google and Intel Corp. Trump has since then dangled the possibility of a resolution to Huawei’s woes being part of a larger trade deal. But Huawei executives say they have had no contact with U.S. authorities and rather than count on a settlement they are shifting supply chains and making other preparations for a prolonged fight.

“We have full confidence in our own survival,’’ Liang Hua, Huawei’s chairman, told American journalists visiting during a trip organized by the U.S.-China Exchange Foundation, a Hong Kong non-profit run by the territory’s former chief executive. Liang outlined more than a decade of planning to replace U.S. suppliers.

Mistrusting Trump

Informing part of the decision to move on is the Chinese view of Trump as an erratic partner after four months of negotiations over a broad trade agreement broke down in May. U.S. officials blamed China for reneging on commitments; the Chinese blamed Trump’s ever-changing demands. That view has been bolstered by Trump’s retreat last week on his threat of tariffs as high as 25% on Mexico — even after negotiating an updated North American Free Trade Agreement that enshrined tariff-free trade.

On either side of the Pacific, there are fundamentally different conceptions of who has leverage.

Trump often touts what he sees as the U.S.’s structural advantage. Because the U.S. imports more from China each year than vice versa, he has more trade to target. When he increased tariffs to 25% from 10% on some $200 billion in goods last month, China raised duties on $60 billion in U.S. goods. If Trump imposes tariffs on all remaining China trade — some $300 billion in goods — Beijing won’t be able to match the raw amount.

Turning Inward

China’s most consequential tactics are aimed at spurring innovation and shoring up its economy: state support the U.S. is demanding it unwind.

Yi Gang, the governor of the People’s Bank of China, last week pointed to a range of tools that Beijing could use to mitigate harm to the world’s second-largest economy, from interest-rate policy to letting the currency weaken. “The room for adjustment is tremendous,” he said.

China has already deployed a stimulus program that bolstered growth. It’s also taking administrative measures to help tech companies like Huawei.

Beijing last year announced a two-year corporate-tax holiday for software and semiconductor-design companies to help close technology gaps. Last week, the government accelerated a 5G spectrum auction to foster the new technology in the world’s biggest market for it. That gave Huawei an advantage in a global race to control airwaves that will carry commands to everything from autonomous cars to data-generating wind turbines and even to fish farms.

Legal Battlements

The government has announced an “unreliable entities” list that would ban U.S. companies that cut off Chinese firms for political reasons. It’s also establishing an export-control system like the one America is employing to target Huawei, so that it can limit technology sold to the U.S.

In private meetings, Chinese tech investors — who continue to shuttle back and forth to Silicon Valley — talk of ordering lawyers to conjure up “sanctions-proof’’ corporate structures for promising startups.

At Cambridge Industries Group Ltd. in Shanghai, which assembles networking equipment for companies such as Nokia Oyj and Ericsson AB, adaptation started a year ago when the company set up a Malaysian factory. It took just three months.

“Most Chinese companies are doing that if they do business with the U.S.,” said Rose Hsu, CIG’s head of marketing. “It’s a dynamic situation. You don’t know what will happen, so you prepare for the worst.’’

Some companies with products already shut out of the U.S. market are simply moving on.

Missing Mark

Envision Energy, a wind-turbine manufacturer that last year bought a controlling interest in Nissan’s battery unit and its Smyrna, Tennessee, factory is more befuddled than gutted. It doesn’t sell turbines in the U.S. and is already focused on expanding battery capacity in China to serve the booming electric-vehicle sector.

“We are building a new factory in China because China has a better supply chain than Europe or the United States,’’ said Zhou Jiangong, the company’s vice president.

Still, evidence of the trade war’s impact is easy to find, said Liu, the U.S.-educated CEO of Chinascope. Private companies are reporting tighter cash flow and new limits on working capital. The labor market is also softening, though that has made it easier and cheaper to retain and recruit talent.

Zha Daojiong, a Peking University political scientist and critic of how both Xi and Trump have handled the trade war, said debate about economic reform in China has been stifled by a new nationalism. “That’s a net loss for our country,’’ he said.

Workerless Workplace

But all that is also coming alongside a new push for efficiency from Chinese companies that in the longer term is likely to make China a more fearsome economic competitor.

At CIG’s headquarters in a sprawling industrial park around the corner from the Shanghai Institute of Space Propulsion, sterile assembly lines are increasingly automated. On a recent afternoon, a line that once relied on more than 60 workers was pumping out Nokia-branded switches to convert high-speed optical broadband signals for use by residential WiFi routers. They arrived at a rate of almost 1,500 per 12-hour shift with just 13 humans and nine robots.

At Envision, drones have turned what was once a laborious three-day task of surveying the tops of office buildings for solar panels into a 24-minute algorithm-fueled sprint. Similar software lays out wind farms. New sensors determine when electric-vehicle batteries should be retired to office buildings to store electricity bought at off-peak rates and save companies millions.

“We are a change company,” said Zhou confidently. And, even as Trump continues to try to box it in, China is looking like a change country.