-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST: Add Socket keepAlive option test.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.spy.memcached; | ||
|
||
import java.net.SocketException; | ||
import java.util.Collection; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import org.junit.Assert; | ||
|
||
public class SocketTest extends TestCase { | ||
private ArcusClient client; | ||
private final String ZK_STRING = "127.0.0.1:2181"; | ||
private final String SERVICE_CODE = "test"; | ||
|
||
@Override | ||
protected void setUp() throws Exception { | ||
super.setUp(); | ||
ConnectionFactoryBuilder connectionFactoryBuilder = new ConnectionFactoryBuilder(); | ||
connectionFactoryBuilder.setKeepAlive(true); | ||
client = ArcusClient.createArcusClient(ZK_STRING, SERVICE_CODE, connectionFactoryBuilder); | ||
} | ||
|
||
public void testSocketKeepAliveTest() throws SocketException { | ||
Collection<MemcachedNode> allNodes = | ||
client.getAllNodes(); | ||
for (MemcachedNode node : allNodes) { | ||
Assert.assertTrue(node.getChannel().socket().getKeepAlive()); | ||
} | ||
} | ||
} |