use of redis.clients.util.RedisInputStream in project new-cloud by xie-summer.
the class ProtocolTest method nullMultiBulkReply.
@SuppressWarnings("unchecked")
@Test
public void nullMultiBulkReply() {
InputStream is = new ByteArrayInputStream("*-1\r\n".getBytes());
List<String> response = (List<String>) Protocol.read(new RedisInputStream(is));
assertNull(response);
}
use of redis.clients.util.RedisInputStream in project new-cloud by xie-summer.
the class ProtocolBenchmark method measureInputStatus.
private static long measureInputStatus() throws Exception {
long duration = 0;
InputStream is = new ByteArrayInputStream("+OK\r\n".getBytes());
RedisInputStream in = new RedisInputStream(is);
for (int n = 0; n <= TOTAL_OPERATIONS; n++) {
long start = System.nanoTime();
Protocol.read(in);
duration += (System.nanoTime() - start);
in.reset();
}
return duration;
}
use of redis.clients.util.RedisInputStream in project cachecloud by sohutv.
the class ProtocolTest method bulkReply.
@Test
public void bulkReply() {
InputStream is = new ByteArrayInputStream("$6\r\nfoobar\r\n".getBytes());
byte[] response = (byte[]) Protocol.read(new RedisInputStream(is));
assertArrayEquals(SafeEncoder.encode("foobar"), response);
}
use of redis.clients.util.RedisInputStream in project cachecloud by sohutv.
the class ProtocolTest method nullMultiBulkReply.
@SuppressWarnings("unchecked")
@Test
public void nullMultiBulkReply() {
InputStream is = new ByteArrayInputStream("*-1\r\n".getBytes());
List<String> response = (List<String>) Protocol.read(new RedisInputStream(is));
assertNull(response);
}
use of redis.clients.util.RedisInputStream in project cachecloud by sohutv.
the class ProtocolTest method singleLineReply.
@Test
public void singleLineReply() {
InputStream is = new ByteArrayInputStream("+OK\r\n".getBytes());
byte[] response = (byte[]) Protocol.read(new RedisInputStream(is));
assertArrayEquals(SafeEncoder.encode("OK"), response);
}
Aggregations