Retrieve closest Tower Node id of a given virtual node id

Is it possible to retrieve the closest Tower Node id of a given virtual node id? For example the starting or ending point may not be a way node, but we still wanted to have the nearest tower node ID

You can pass the virtual node to the queryGraph and fetch its adjacent nodes:

EdgeExplorer ee = graph.createEdgeExplorer();
EdgeIterator iter = ee.setBaseNode(virtNode);
while(iter.next()) {
   // now two nodes will be returned where you can calculate the distance or other 'close' definitions
   int node = iter.getAdjNode();
   // ...
}

For example the starting or ending point may not be a way node

What do you mean here? Do you mean the starting node of a GPS track and the related discussion here: https://github.com/graphhopper/map-matching/pull/51 ?