the appropriate code can be find at two different places depending on the method you use:
DHT: the routing was started by nodeLookup() or valueLookup(): The forwarding is managed by the PastryMessageHandler. In lines 233ff you find the code for this.
KBR: the routing was started by route(): The forwarding is managed by the common KBR components. They take use of implemented methods like route() or local_lookup(), but the real forwarding code is in the KBRMsgHandler class at lines 161ff.
Depending on your concrete use case, you should modify or extend one of the described components. I hope I could help you.