Github user asdf2014 commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/257#discussion_r117600449
--- Diff: src/java/test/org/apache/zookeeper/test/CnxManagerTest.java ---
@@ -351,15 +351,55 @@ public void testSocketTimeout() throws Exception {
LOG.info("Election port: " + port);
Thread.sleep(1000);
- Socket sock = new Socket();
- sock.connect(peers.get(1L).electionAddr, 5000);
- long begin = Time.currentElapsedTime();
- // Read without sending data. Verify timeout.
- cnxManager.receiveConnection(sock);
- long end = Time.currentElapsedTime();
- if((end - begin) > ((peer.getSyncLimit() * peer.getTickTime()) +
500)) Assert.fail("Waited more than necessary");
- cnxManager.halt();
- Assert.assertFalse(cnxManager.listener.isAlive());
+ try (Socket sock = new Socket()) {
--- End diff --
Okay! I will separate it into a different `jira`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---