When President Xi Jinping took the stage in Davos in January and painted China as a champion of free markets ready to fill the global leadership role vacated by the United States, German officials couldn't help but chuckle.
Their expectation was that Donald Trump, due to be inaugurated as U.S. president days later, would quickly temper his protectionist campaign rhetoric and patch up ties with Western allies, leaving little space for Beijing.
Six months later, as Xi arrives in Berlin for a highly symbolic visit with German Chancellor Angela Merkel before a Group of 20 summit in Hamburg, what seemed laughable in the thin mountain air of the Swiss Alps is not so absurd any more.
Despite concerns about human rights in China, frustrations over market access and worries about a wave of corporate takeovers in Europe by state-run Chinese firms, Germany is being pushed into an awkward embrace with Beijing as Trump doubles down on his promise to put "America First".
For Merkel, the G20 host, Xi is an ally and Trump a troublesome rival on some of the most important issues on the agenda in Hamburg - from trade and climate change to economic development in Africa.
And so, Merkel will dine with Xi on Tuesday and plot G20 strategy with him over lunch on Wednesday.
After that, the two leaders will indulge in classic "panda diplomacy", opening a $10 million Chinese compound in Berlin Zoo for Meng Meng and Jiao Qing - two giant pandas that China is lending to Germany as a token of friendship.
"For Beijing, the goal is to present itself as a generous, cooperative and friendly power, at home and abroad," said Sebastian Heilmann, director of the Mercator Institute for Chinese Studies (MERICS) in Berlin. "It also serves to distract from politically controversial topics."
BIG POWER TENSIONS
The visit, a month after Chinese Premier Li Keqiang traveled to Berlin to meet Merkel, comes at an extremely sensitive time for big-power relations.
Trump is ratcheting up pressure on Beijing to restrain North Korea, which on Tuesday announced that it had successfully test-launched an intercontinental ballistic missile that showed it could strike anywhere in the world.
His administration is threatening punitive trade measures against China on steel, a step that could also hit German exporters. Meanwhile a U.S. warship sailed near a disputed island in the South China Sea on Sunday, prompting Beijing to complain of a "serious political and military provocation".
Against that backdrop, Xi needs allies, and Germany is top of the list.
In a guest commentary in the German daily Die Welt on Tuesday, he called for an intensification of ties, saying the two countries should assume responsibility for peace, stability and prosperity.
While welcoming closer dialogue, the German government may have less lofty aims.
Eberhard Sandschneider, a China expert at Berlin's Free University, said Merkel's main goal was to gather as many allies as possible on climate, trade and Africa before the G20 summit, describing the encounter as a pure "coordination meeting".
German officials have not shied away from criticizing China on a range of issues in recent weeks, including cyber espionage and Beijing's treatment of cancer-stricken pro-democracy activist and Nobel Peace Prize winner Liu Xiaobo.
In an interview with the German magazine Wirtschaftwoche last week, Merkel expressed concern about the treatment of German firms in China and attempts by Beijing to play European countries off against each other.
"Beijing views Europe as an Asian peninsula. We see it differently," she said. "Nevertheless, it is a fact that parts of German industry are dependent on China. So we need to deal with China's demands in a way that brings harmony and advantages for both sides."
The pandas, and an excursion by Merkel and Xi to Berlin's Olympic Stadium to discuss German-Chinese soccer cooperation, should ensure that is where the focus of the visit remains.