Esempio n. 1
0
  /**
   * Test compatability between version 4.1.0 and the current version.
   *
   * <p>Server side throttling does't work when current client connects to old version server.
   */
  @Test(timeout = 60000)
  public void testServerSideThrottleCompat410() throws Exception {
    ByteString topic = ByteString.copyFromUtf8("TestServerSideThrottleCompat410");
    ByteString subid = ByteString.copyFromUtf8("mysub");

    // start bookkeeper
    BookKeeperCluster410 bkc410 = new BookKeeperCluster410(3);
    bkc410.start();

    int port = PortManager.nextFreePort();
    int sslPort = PortManager.nextFreePort();

    // start hub server 410
    Server410 s410 = new Server410(zkUtil.getZooKeeperConnectString(), port, sslPort);
    s410.start();

    ClientCurrent ccur = new ClientCurrent(false, "localhost:" + port + ":" + sslPort);
    ccur.throttleX41(topic, subid, 10);

    ccur.close();

    // stop 410 server
    s410.stop();
    // stop bookkeeper cluster
    bkc410.stop();
  }