String cancelShares(String user, String pass, int id, int sellid) { int cmdID = commID++; connect(user, pass); try { out.println(cmdID + ";cancel:" + id + ":" + sellid); out.flush(); return (String) receiveReply(cmdID); } catch (Exception r) { r.printStackTrace(); } return null; }
String getChatHistory(String user, String pass) { int cmdID = commID++; connect(user, pass); try { out.println(cmdID + ";chath"); out.flush(); return (String) receiveReply(cmdID); } catch (Exception r) { r.printStackTrace(); } return null; }
String sendChat(String s, String user, String pass) { int cmdID = commID++; connect(user, pass); try { out.println(cmdID + ";chat:" + s.trim()); out.flush(); return (String) receiveReply(cmdID); } catch (Exception r) { r.printStackTrace(); } return null; }
void placeOrder(final User user, String cmd, Company comp, int qty, int id) { int cmdID = commID++; connect(user.getName(), user.getPassword()); try { out.println(cmdID + ";" + cmd + ":" + comp.name + ":" + Integer.toString(qty) + ":" + id); out.flush(); Shares pen = (Shares) receiveReply(cmdID); user.getPendingShares().add(pen); user.dataChanged(); } catch (Exception r) { r.printStackTrace(); } }
String login(String domain, String user, String pass) { int cmdID = commID++; this.domain = domain; connect(user, pass); try { out.println(cmdID + ";login:"******":" + pass); out.flush(); String rep = (String) receiveReply(cmdID); return rep.split(":")[0]; } catch (Exception r) { r.printStackTrace(); } return null; }
User getUserDetails(String user, String pass) { int cmdID = commID++; connect(user, pass); try { usrD = 1; out.println(cmdID + ";gud"); out.flush(); User vv = (User) receiveReply(cmdID); usrD = 0; return vv; } catch (Exception r) { r.printStackTrace(); } return null; }
@Test public void connectTest() throws IOException { c.connect(s, 9000); assertEquals(100, score.getScore()); }