handle quit command response as it was leaving the socket in an unconsistent state

This commit is contained in:
Jonathan Leibiusky
2011-05-11 14:06:07 -03:00
parent 0885681f63
commit 22b2229ba0
3 changed files with 17 additions and 3 deletions

View File

@@ -77,9 +77,10 @@ public class BinaryJedis implements BinaryJedisCommands {
/**
* Ask the server to silently close the connection.
*/
public void quit() {
public String quit() {
checkIsInMulti();
client.quit();
return client.getStatusCodeReply();
}
/**

View File

@@ -69,9 +69,10 @@ public class Jedis extends BinaryJedis implements JedisCommands {
* Ask the server to silently close the connection.
*/
public void quit() {
public String quit() {
checkIsInMulti();
client.quit();
return client.getStatusCodeReply();
}
/**

View File

@@ -2,9 +2,21 @@ package redis.clients.jedis.tests.commands;
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 {
protected static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
@Test
public void quit() {
jedis.quit();
assertEquals("OK", jedis.quit());
}
@Test
public void binary_quit() {
BinaryJedis bj = new BinaryJedis(hnp.host);
assertEquals("OK", bj.quit());
}
}