private RosterItem removeItem(org.jivesoftware.openfire.roster.Roster roster, JID sender,
            org.xmpp.packet.Roster.Item item) throws SharedGroupException {
        JID recipient = item.getJID();
        // Remove recipient from the sender's roster
        RosterItem removedItem = roster.deleteRosterItem(item.getJID(), true);

        // Forward set packet to the subscriber
        if (localServer.isLocal(recipient)) { // Recipient is local so let's handle it here
            try {
                Roster recipientRoster = userManager.getUser(recipient.getNode()).getRoster();
                // Instead of deleting the sender in the recipient's roster, update it.
                // https://igniterealtime.atlassian.net/browse/OF-720
                RosterItem rosterItem = recipientRoster.getRosterItem(sender);
                // If the receiver doesn't have subscribed yet, delete the sender from the receiver's roster, too.
                if (rosterItem.getRecvStatus().equals(RosterItem.RECV_SUBSCRIBE)) {
                    recipientRoster.deleteRosterItem(sender, true);
                }
                // Otherwise only update it, so that the sender is not deleted from the receivers roster.
                else {
                    rosterItem.setAskStatus(RosterItem.ASK_NONE);
                    rosterItem.setRecvStatus(RosterItem.RECV_NONE);
                    rosterItem.setSubStatus(RosterItem.SUB_NONE);
                    recipientRoster.updateRosterItem(rosterItem);
                }
            }
            catch (UserNotFoundException e) {
                // Do nothing
            }
        }
        else {
            // Recipient is remote so we just forward the packet to them
            String serverDomain = localServer.getServerInfo().getXMPPDomain();
            // Check if the recipient may be hosted by this server
            if (!recipient.getDomain().contains(serverDomain)) {
                // TODO Implete when s2s is implemented
            }
            else {
                Packet removePacket = createRemoveForward(sender, recipient);
                router.route(removePacket);
            }
        }
        return removedItem;
    }
Remove the roster item from the sender's roster (and possibly the recipient's).
Actual roster removal is done in the removeItem(Roster,RosterItem) method.

@param roster The sender's roster.
@param sender The JID of the sender of the removal request
@param item   The removal item element
@return The removed item or null, if not item has been removed.
xmppserver/src/main/java/org/jivesoftware/openfire/handler/IQRosterHandler.java