Getting a list of newsgroups from an NNTP server in Java

There is an undocumented Sun package called sun.net.nntp. Following
example shows you the first 20 newsgroups of the free news server
news.uni-stuttgart.de. Beware:
Why Developers Should Not Write Programs That Call ‘sun’ Packages

import sun.net.nntp.*;
import java.io.*;
 
public class Main extends NntpClient {
 
   public static void main(String[] args) {
    
      String server = "news.uni-stuttgart.de";
  
      try {
         NntpClient nntp = new NntpClient(server);
  
         nntp.serverOutput.println("LIST NEWSGROUPS");
         BufferedReader br = new BufferedReader(new InputStreamReader(nntp.serverInput));
 
         String line = "";
         int count = 0;
         while ((line = br.readLine()) != null) {
            if (line.equals(".")) break;
            if (count == 20) break;
             
            System.out.println(line);
            count++;
         }
 
         nntp.askServer("QUIT");
         nntp.closeServer(); 
      }
      catch (IOException e) {
         System.err.println(e);
      }
   }
}

outputs:

215 Descriptions in form "group description".
alt.0d			Yet another attempt to collect stupid people up front.
alt.1d			One-dimensional imaging, & the thinking behind it.
alt.2600d		No description.
alt.2600hz		No description.
alt.3d			Use alt.3d.misc instead.
alt.3d.misc		Three-dimensional imaging.
alt.3d.rhino		Rhino, a Windows NURBS curve, surface, & solid modeler.
alt.3d.sirds		Especially for Single Image Random Dot Stereograms.
alt.3d.studio		For 3D Studio users.
alt.3djam-tv		Press Releases for Fabs Music & Jam-TV
alt.3d.misc		Three-dimensional imaging.
alt.3d.studio		For 3D Studio users.
alt.abortion.inequity	Paternal obligations of failing to abort unwanted child.
alt.abuse.recovery	Helping victims of abuse to recover.
alt.acting		I'm just not myself today.
alt.activism		Activities for activists.
alt.activism.children	Open discussion of political issues about children.
alt.activism.children.cps-issues	No description.
alt.activism.children.cps-reform	No description.