handle quit command response as it was leaving the socket in an unconsistent state
This commit is contained in:
@@ -77,9 +77,10 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
/**
|
/**
|
||||||
* Ask the server to silently close the connection.
|
* Ask the server to silently close the connection.
|
||||||
*/
|
*/
|
||||||
public void quit() {
|
public String quit() {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.quit();
|
client.quit();
|
||||||
|
return client.getStatusCodeReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -69,9 +69,10 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
|||||||
* Ask the server to silently close the connection.
|
* Ask the server to silently close the connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void quit() {
|
public String quit() {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.quit();
|
client.quit();
|
||||||
|
return client.getStatusCodeReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,9 +2,21 @@ package redis.clients.jedis.tests.commands;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import redis.clients.jedis.BinaryJedis;
|
||||||
|
import redis.clients.jedis.tests.HostAndPortUtil;
|
||||||
|
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
|
||||||
|
|
||||||
public class ConnectionHandlingCommandsTest extends JedisCommandTestBase {
|
public class ConnectionHandlingCommandsTest extends JedisCommandTestBase {
|
||||||
|
protected static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void quit() {
|
public void quit() {
|
||||||
jedis.quit();
|
assertEquals("OK", jedis.quit());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void binary_quit() {
|
||||||
|
BinaryJedis bj = new BinaryJedis(hnp.host);
|
||||||
|
assertEquals("OK", bj.quit());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user