Why don't you simply use the Socket system ?
Open a socket to the chosen server on port 23 and send your own commands from here.
Here is a quick example :
public class EchoClient {
public static void main(String[] args) throws IOException {
Socket pingSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
pingSocket = new Socket("servername", 23);
out = new PrintWriter(pingSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(pingSocket.getInputStream()));
} catch (IOException e) {
return;
}
out.println("ping");
System.out.println(in.readLine());
out.close();
in.close();
pingSocket.close();
}
}
Resources :
- oracle.com - All about sockets