Currently, passing anything but DB_MASTER to LoadBalancer::getConnection() will result in a replica being selected based on load balancing and the specified groups. Effectively, it'S impossible to select a specific connection by providing an explicit index.
This issue was introduced by https://gerrit.wikimedia.org/r/#/c/178747/ and, even before that, in https://phabricator.wikimedia.org/rSVN8540 (MW 1.4). In the light of this, perhaps the interface contract should be changed to do disallow explicit selection - the fact that this issue went undetected for years indicates that there is no need for explicit selection of connections.