Refactor Connection.prototype.apply hijack