This assumes that a PONG response from the server means the connection is still intact. The messages could still have been dropped for weird reasons, but short of using a second client to confirm the delivery directly, there is no better option to test this.
RFC 1459 actually specifies that "servers should not respond to PING commands". However, this recommendation has been removed in RFC 2812, and in practice, all common IRC servers seem to respond to PINGs.