International to international connections in Taipei do not require you to go through passport control and customs. Assuming that your checked baggage is interlined to your onward connection, you will just need to go to the transfer desk in TPE and get a boarding pass if you don't get one at HKG (this is probably the case if you go from CX to UA; you probably can get a boarding pass in HKG if you are flying from one Star Alliance carrier to another). You probably may have to go through a secondary security screening before getting to the gate but it is nowhere as onerous as screening at a US airport.