Package redis.clients.util

Examples of redis.clients.util.RedisOutputStream


    @Test
    public void buildACommand() throws IOException {
  PipedInputStream pis = new PipedInputStream();
  BufferedInputStream bis = new BufferedInputStream(pis);
  PipedOutputStream pos = new PipedOutputStream(pis);
  RedisOutputStream ros = new RedisOutputStream(pos);

  Protocol.sendCommand(ros, Protocol.Command.GET,
    "SOMEKEY".getBytes(Protocol.CHARSET));
  ros.flush();
  pos.close();
  String expectedCommand = "*2\r\n$3\r\nGET\r\n$7\r\nSOMEKEY\r\n";

  int b;
  StringBuilder sb = new StringBuilder();
View Full Code Here


  assertEquals(expectedCommand, sb.toString());
    }

    @Test(expected = IOException.class)
    public void writeOverflow() throws IOException {
  RedisOutputStream ros = new RedisOutputStream(new OutputStream() {

      @Override
      public void write(int b) throws IOException {
    throw new IOException("thrown exception");

      }
  });

  ros.write(new byte[8191]);

  try {
      ros.write((byte) '*');
  } catch (IOException ioe) {
  }

  ros.write((byte) '*');

    }
View Full Code Here

               // immediately
    // <-@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

                socket.setSoLinger(true,0)//Control calls close () method, the underlying socket is closed immediately
                //<-@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

Related Classes of redis.clients.util.RedisOutputStream

Copyright © 2018 www.massapicom. 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.