Exemple #1
0
 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;
 }
Exemple #2
0
 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;
 }
Exemple #3
0
 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;
 }
Exemple #4
0
 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();
   }
 }
Exemple #5
0
 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;
 }
Exemple #6
0
 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;
 }
Exemple #7
0
 @Test
 public void connectTest() throws IOException {
   c.connect(s, 9000);
   assertEquals(100, score.getScore());
 }