Examples of RedisInputStream


Examples of com.cetsoft.imcache.cache.redis.client.util.RedisInputStream

                socket.setSoLinger(true, 0);

                socket.connect(new InetSocketAddress(host, port), timeout);
                socket.setSoTimeout(timeout);
                outputStream = new RedisOutputStream(socket.getOutputStream());
                inputStream = new RedisInputStream(socket.getInputStream());
            } catch (IOException e) {
                throw new RedisConnectionException(e);
            }
        }
    }
View Full Code Here

Examples of redis.clients.util.RedisInputStream

    }

    @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);
    }
View Full Code Here

Examples of redis.clients.util.RedisInputStream

    @Test
    public void fragmentedBulkReply() {
  FragmentedByteArrayInputStream fis = new FragmentedByteArrayInputStream(
    "$30\r\n012345678901234567890123456789\r\n".getBytes());
  byte[] response = (byte[]) Protocol.read(new RedisInputStream(fis));
  assertArrayEquals(SafeEncoder.encode("012345678901234567890123456789"),
    response);
    }
View Full Code Here

Examples of redis.clients.util.RedisInputStream

    }

    @Test
    public void nullBulkReply() {
  InputStream is = new ByteArrayInputStream("$-1\r\n".getBytes());
  String response = (String) Protocol.read(new RedisInputStream(is));
  assertEquals(null, response);
    }
View Full Code Here

Examples of redis.clients.util.RedisInputStream

    }

    @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);
    }
View Full Code Here

Examples of redis.clients.util.RedisInputStream

    }

    @Test
    public void integerReply() {
  InputStream is = new ByteArrayInputStream(":123\r\n".getBytes());
  long response = (Long) Protocol.read(new RedisInputStream(is));
  assertEquals(123, response);
    }
View Full Code Here

Examples of redis.clients.util.RedisInputStream

    public void multiBulkReply() {
  InputStream is = new ByteArrayInputStream(
    "*4\r\n$3\r\nfoo\r\n$3\r\nbar\r\n$5\r\nHello\r\n$5\r\nWorld\r\n"
      .getBytes());
  List<byte[]> response = (List<byte[]>) Protocol
    .read(new RedisInputStream(is));
  List<byte[]> expected = new ArrayList<byte[]>();
  expected.add(SafeEncoder.encode("foo"));
  expected.add(SafeEncoder.encode("bar"));
  expected.add(SafeEncoder.encode("Hello"));
  expected.add(SafeEncoder.encode("World"));
View Full Code Here

Examples of redis.clients.util.RedisInputStream

    @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);
    }
View Full Code Here

Examples of redis.clients.util.RedisInputStream

    // <-@wjw_add

    socket.connect(new InetSocketAddress(host, port), timeout);
    socket.setSoTimeout(timeout);
    outputStream = new RedisOutputStream(socket.getOutputStream());
    inputStream = new RedisInputStream(socket.getInputStream());
      } catch (IOException ex) {
    broken = true;
    throw new JedisConnectionException(ex);
      }
  }
View Full Code Here

Examples of redis.clients.util.RedisInputStream

                //<-@wjw_add

                socket.connect(new InetSocketAddress(host, port), timeout);
                socket.setSoTimeout(timeout);
                outputStream = new RedisOutputStream(socket.getOutputStream());
                inputStream = new RedisInputStream(socket.getInputStream());
            } catch (IOException ex) {
                throw new JedisConnectionException(ex);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.