EVALUATION
The issue here is that the delegating/wrapping Selector used in Glassfish is exposing, to the user, SelectionKeys that are associated with the default provider. As a result, the user has Selectors and SelectionKeys that are associated with different providers and this is why the keyFor method fails. The correct solution is to modify the delegating Selector so that it wraps the SelectionKeys.