List of usage examples for org.apache.commons.net.nntp NNTPClient getReplyString
public String getReplyString()
From source file:examples.nntp.newsgroups.java
public final static void main(String[] args) { NNTPClient client; NewsgroupInfo[] list;/* w w w . ja va2 s . c om*/ if (args.length < 1) { System.err.println("Usage: newsgroups newsserver"); System.exit(1); } client = new NNTPClient(); try { client.connect(args[0]); list = client.listNewsgroups(); if (list != null) { for (int i = 0; i < list.length; i++) System.out.println(list[i].getNewsgroup()); } else { System.err.println("LIST command failed."); System.err.println("Server reply: " + client.getReplyString()); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (client.isConnected()) client.disconnect(); } catch (IOException e) { System.err.println("Error disconnecting from server."); e.printStackTrace(); System.exit(1); } } }
From source file:ProtocolRunner.java
private static void handleNNTP( NNTPClient client, ProtocolRunner runner, /* w ww . j av a2s. c o m*/ String commandString) throws IOException { if(commandString == null) { // means just connected // check if the server response was valid if(!NNTPReply.isPositiveCompletion(client.getReplyCode())) { runner.handleDisconnect(); return; } } else { // need to handle a command client.sendCommand(commandString); } runner.getTCPServerResponse().append(client.getReplyString()); }
From source file:org.rssowl.contrib.internal.nntp.NewsGroupHandler.java
private void throwConnectionException(String msg, NNTPClient client) throws ConnectionException { StringBuilder str = new StringBuilder(); str.append(msg);//from w w w. j av a2 s . c o m str.append(" (").append(client.getReplyString()).append(")"); throw new ConnectionException(Activator.createErrorStatus(str.toString(), null)); }