Package de.pokerth.protocol.ProtoBuf

Examples of de.pokerth.protocol.ProtoBuf.PlayerListMessage


    PokerTHMessage msg;
    msg = receiveMessage();
    assertTrue(msg.hasPlayerListMessage());

    // This should be a "player list new" notification with correct player id.
    PlayerListMessage listMsg = msg.getPlayerListMessage();
    assertEquals(myId, listMsg.getPlayerId());
    assertEquals(PlayerListNotification.playerListNew, listMsg.getPlayerListNotification());

    Socket s[] = new Socket[9];
    long playerId[] = new long[9];
    for (int i = 0; i < 9; i++) {
      s[i] = new Socket("localhost", 7234);
      String username = "test" + (i+1);
      String password = username;
      playerId[i] = userInit(s[i], username, password);

      msg = receiveMessage();
      assertTrue(msg.hasPlayerListMessage());
      listMsg = msg.getPlayerListMessage();
      // Id should be different from first id.
      assertTrue(myId != playerId[i]);
      // This should be a "player list new" notification with correct player id.
      assertEquals(playerId[i], listMsg.getPlayerId());
      assertEquals(PlayerListNotification.playerListNew, listMsg.getPlayerListNotification());

      s[i].close();

      // After the connection is closed, a "player list left" notification should be received.
      msg = receiveMessage();
      assertTrue(msg.hasPlayerListMessage());
      listMsg = msg.getPlayerListMessage();
      assertEquals(playerId[i], listMsg.getPlayerId());
      assertEquals(PlayerListNotification.playerListLeft, listMsg.getPlayerListNotification());
    }
  }
View Full Code Here

TOP

Related Classes of de.pokerth.protocol.ProtoBuf.PlayerListMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.