}
@Override
public RemoteServerContext login(String username, String password) throws LoginException {
try {
SerialListener serial = new SerialListener();
TransListener transListener = new TransListener();
final PokersourceConnection conn = new PokersourceConnection(server);
conn.addListeners(serial, transListener);
conn.send(new Login(username, password));
serialObtained.await();
conn.removeListeners(serial, transListener);
return new PSServerContext(conn, serial.getSerial());
} catch (IOException e) {
throw new LoginException(e.getMessage());
} catch (JSONException e) {
throw new LoginException(e.getMessage());
} catch (InterruptedException e) {