src/main/java/org/jivesoftware/smack/UserRoster.java
public void removeEntry(RosterEntry entry) throws XMPPException {
        if (!connection.isAuthenticated()) {
            throw new IllegalStateException("Not logged in to server.");
        }
        if (connection.isAnonymous()) {
            throw new IllegalStateException(
                    "Anonymous users can't have a roster.");
        }

        // Only remove the entry if it's in the entry list.
        // The actual removal logic takes place in
        // RosterPacketListenerprocess>>Packet(Packet)
        if (!entries.containsKey(entry.getUser())) {
            return;
        }
        Roster packet = new Roster();
        packet.setType(IQ.Type.set);
        packet.addItem(new JID(entry.getUser()), entry.getName(),
                entry.getAsk(), Subscription.remove, entry.getGroupNames());
        PacketCollector collector = connection
                .createPacketCollector(new PacketIDFilter(packet.getID()));
        connection.sendPacket(packet);
        IQ response = (IQ) collector.nextResult(SmackConfiguration
                .getPacketReplyTimeout());
        collector.cancel();
        if (response == null) {
            throw new XMPPException("No response from the server.");
        }
        // If the server replied with an error, throw an exception.
        else if (response.getType() == IQ.Type.error) {
            throw new XMPPException(response.getError());
        }
    }
public void removeEntry(RosterEntry entry) throws XMPPException {
        if (!connection.isAuthenticated()) {
            throw new IllegalStateException("Not logged in to server.");
        }
        if (connection.isAnonymous()) {
            throw new IllegalStateException(
                    "Anonymous users can't have a roster.");
        }

        // Only remove the entry if it's in the entry list.
        // The actual removal logic takes place in
        // RosterPacketListenerprocess>>Packet(Packet)
        if (!entries.containsKey(entry.getUser())) {
            return;
        }
        Roster packet = new Roster();
        packet.setType(IQ.Type.set);
        packet.addItem(new JID(entry.getUser()), entry.getName(),
                entry.getAsk(), Subscription.remove, entry.getGroupNames());
        PacketCollector collector = connection
                .createPacketCollector(new PacketIDFilter(packet.getID()));
        connection.sendPacket(packet);
        IQ response = (IQ) collector.nextResult(SmackConfiguration
                .getPacketReplyTimeout());
        collector.cancel();
        if (response == null) {
            throw new XMPPException("No response from the server.");
        }
        // If the server replied with an error, throw an exception.
        else if (response.getType() == IQ.Type.error) {
            throw new XMPPException(response.getError());
        }
    }
Removes a roster entry from the roster. The roster entry will also be
removed from the unfiled entries or from any roster group where it could
belong and will no longer be part of the roster. Note that this is an
asynchronous call -- Smack must wait for the server to send an updated
subscription status.

@param entry
a roster entry.
@throws XMPPException
if an XMPP error occurs.
@throws IllegalStateException
if connection is not logged in or logged in anonymously