private void sendPingPacket(Channel channel) throws UnauthorizedException {
        NettyConnection connection = channel.attr(CONNECTION).get();
        JID entity = connection.getSession() == null ? null : connection.getSession().getAddress();
        if (entity != null) {
            // Ping the connection to see if it is alive.
            final IQ pingRequest = new IQ(IQ.Type.get);
            pingRequest.setChildElement("ping", IQPingHandler.NAMESPACE);
            pingRequest.setFrom(XMPPServer.getInstance().getServerInfo().getXMPPDomain());
            pingRequest.setTo(entity);

            Log.debug("Pinging connection that has been idle: {}", connection);

            // OF-1497: Ensure that data sent to the client is processed through LocalClientSession, to avoid
            // synchronisation issues with stanza counts related to Stream Management (XEP-0198)!
            LocalClientSession ofSession = (LocalClientSession) SessionManager.getInstance().getSession(entity);
            if (ofSession == null) {
                Log.warn("Trying to ping a Netty connection that's idle, but has no corresponding Openfire session. Netty Connection: {}", connection);
            } else {
                ofSession.deliver(pingRequest);
            }
        }
    }
Sends an IQ ping packet on the channel associated with the channel handler context.

@param channel Channel over which to send a ping.
@throws UnauthorizedException when attempting to deliver ping packet
xmppserver/src/main/java/org/jivesoftware/openfire/nio/NettyIdleStateKeepAliveHandler.java