Did you flush the BufferedWriter? You also need to append \r\n to signal end of message.
sender.write("PONG tmi.twitch.tv\r\n");
sender.flush();
Also, this should only be in the event of a PING messages. You need to listen to the socket in a BufferedReader and respond with an appropriate pong message (the same trailing characters as you received). I believe you need to be sending “PONG :tmi.twitch.tv”, but this should be generated from the message received, as in the linked example.
Take notice that the line:
if (line.toLowerCase( ).startsWith("PING ")) {
Needs to be substituted with
if (line.startsWith("PING ")) {