Exemplo n.º 1
0
 @Test(timeout = 5000)
 public void testSameUserName() throws IOException, InterruptedException {
   TestClient client2 = createTestClient();
   client2.send(new LoginMessage(client1.getName()));
   WelcomeMessage welcomeMessage = client2.await(WelcomeMessage.class);
   assertFalse(welcomeMessage.isOK());
 }
Exemplo n.º 2
0
  @Test(timeout = 10000)
  public void testOnlyOneInvite() throws IOException, InterruptedException {
    TestClient client2 = createTestClient();

    client2.send(new LoginMessage("client2"));
    WelcomeMessage welcomeMessage = client2.await(WelcomeMessage.class);
    assertTrue(welcomeMessage.isOK());
    int client2id = welcomeMessage.getUserId();

    client1.await(UserStatusMessage.class);
    client1.await(ChatMessage.class);

    client1.send(new StartGameRequest(client2id, getTestMod()));
    client1.send(new StartGameRequest(client2id, getTestMod()));
    client1.await(ServerErrorMessage.class);
  }