Hi illarion,
Sure, you can combine both TA and TF into the same application. We talk about the different licensing types and mention you can include any/all here:http://wyday.com/limelm/help/licensing-types/
It'd be up to you to implement whatever you/your customer's requirements are, and manage the choice between licensing a given computer or planning to use floating licensing. You could handle it in your installer, and/or your app.
I'm unaware of any sample code, as it's really specific to the use case(s) you're facing - but all the pieces are there for you in the documentation and examples for TA and TF, respectively. And you'd of course have to add the code to your app to implement/allow TF and have your client deploy the TF Server on a machine on their network.
A few other users have asked about supporting both in the same app historically - perhaps (if they went ahead with it and are reading this) they can share any lessons-learned.