Skip to content

Commit

Permalink
TEST: Add Socket keepAlive option test.
Browse files Browse the repository at this point in the history
  • Loading branch information
brido4125 authored and jhpark816 committed Sep 15, 2023
1 parent c87a852 commit a095630
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/test/java/net/spy/memcached/SocketTest.java
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());
}
}
}

0 comments on commit a095630

Please sign in to comment.