The transition has been underway ever since the 1984 Joint Deceleration between China and the British government of Margaret Thatcher. Everyone involved has incentive for the transition to go smoothly. The 6 million people of Hong Kong have an obvious stake in maintaining their high standard of living. China is Hong Kong's principal trading partner. Hong Kong's confidence is reflected in its soaring stock market.
China has great incentive for the handover to succeed as well.
Hong Kong constitutes a critical economic gateway between the mainland and the outside world. But China's stake is also political. Hong Kong represents another step on the path of reunification. The leadership in Beijing wants to do nothing that would set back efforts to gain Taiwan. China also is likely to act with restraint because of its larger need for good relations with the world.