*/
public class KongaCommandSocketListenerTest {
public static void main(String[] args) {
// Use scheduler port for testing...
CommandListener listener = new KongaCommandSocketListener(46906, "Scheduler");
listener.registerCommandHandler("bubba", null);
CommandHandler dummy = new CommandHandler() {
@Override
public CommandResult handleCommand(Command command) {
KongaCommandResult result = new KongaCommandResult(command.getCommandName());
result.addReturnValue("3");
result.addReturnValue("Simulating Scheduler using Java....");
return result;
}
};
listener.registerCommandHandler("GetStatus", dummy);
try {
listener.startListening();
Thread.sleep(6000);
listener.stopListening();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (Exception e) {
System.err.println(e.getMessage());
}