public void handle(Command command, String[] args, Application application) throws CommandException { if (command == Command.represent) { PersistentTradingClient client = application.getTradingClient(); PersistentTradingContext profile = client.getTradingContext(); if (args.length == 1) { System.out.println(); try { FundManager manager = new FundManager(args[0]); if (profile.hasProxy()) { if (profile.hasProxy(manager)) { client.representFundManager(manager); System.out.println("The proxy client is now representing " + manager); } else { System.out.println( "Invalid client username: "******"The proxy cannot represent " + manager); } } else { throw new CommandException("Current user is not a proxy client"); } } catch (TimeoutException e) { System.out.println(command + " failed: " + e); } catch (InterruptedException e) { System.out.println(command + " failed: " + e); } catch (ConnectionException e) { System.out.println(command + " failed: " + e); } catch (ProxyClientException e) { System.out.println(command + " failed: " + e); } System.out.println(); } else { throw new CommandException(); } } else { throw new AssertionError("Unknown proxy command: " + command); } }