src/main/java/org/jivesoftware/smack/PacketWriter.java
public void sendPacket(Packet packet) {
        if (!done) {
            // Invoke interceptors for the new packet that is about to be sent.
            // Interceptors
            // may modify the content of the packet.
            connection.firePacketInterceptors(packet);

            try {
                queue.put(packet);
            } catch (InterruptedException ie) {
                LOGGER.log(
                        Level.ERROR,
                        "Failed to queue packet to send to server: "
                                + packet.toString(), ie);
                return;
            }
            synchronized (queue) {
                queue.notifyAll();
            }

            // Process packet writer listeners. Note that we're using the
            // sending
            // thread so it's expected that listeners are fast.
            connection.firePacketSendingListeners(packet);
        }
    }
public void sendPacket(Packet packet) {
        if (!done) {
            // Invoke interceptors for the new packet that is about to be sent.
            // Interceptors
            // may modify the content of the packet.
            connection.firePacketInterceptors(packet);

            try {
                queue.put(packet);
            } catch (InterruptedException ie) {
                LOGGER.log(
                        Level.ERROR,
                        "Failed to queue packet to send to server: "
                                + packet.toString(), ie);
                return;
            }
            synchronized (queue) {
                queue.notifyAll();
            }

            // Process packet writer listeners. Note that we're using the
            // sending
            // thread so it's expected that listeners are fast.
            connection.firePacketSendingListeners(packet);
        }
    }
Sends the specified packet to the server.

@param packet
the packet to send.