// Path: java/client/src/main/java/jp/co/rakuten/rit/roma/client/ClientException.java
// public class ClientException extends Exception {
//   private static final long serialVersionUID = -7032182229500031385L;
// 
//   public ClientException() {
//     super();
//   }
// 
//   public ClientException(Throwable cause) {
//     super(cause);
//   }
// 
//   public ClientException(String reason) {
//     super(reason);
//   }
// 
//   public ClientException(String reason, Throwable cause) {
//     super(reason, cause);
//   }
// }
// 
// Path: java/client/src/main/java/jp/co/rakuten/rit/roma/client/Connection.java
// public class Connection {
//   public Socket sock;
// 
//   public ExtInputStream in;
// 
//   public OutputStream out;
// 
//   /**
//    * Construct a connection to a ROMA process.
//    * 
//    * @param sock
//    *          - a socket of the ROMA process to connect to
//    * @throws IOException
//    *           - if creating this connection fails
//    */
//   public Connection(final Socket sock) throws IOException {
//     this.sock = sock;
//     this.in = new ExtInputStream(sock.getInputStream());
//     this.out = new BufferedOutputStream(sock.getOutputStream());
//   }
// 
//   public void setTimeout(int timeout) throws SocketException {
// 	  this.sock.setSoTimeout(timeout);
//   }
//   
//   /**
//    * Close this connection.
//    * 
//    * @throws IOException
//    *           - if closing this connection fails
//    */
//   public void close() throws IOException {
//     if (in != null) {
//       in.close();
//     }
//     if (out != null) {
//       out.close();
//     }
//     if (sock != null) {
//       sock.close();
//     }
//   }
// 
//   public static long TIME = 0;
// 
//   public class ExtInputStream extends BufferedInputStream {
// 
//     private byte[] one_byte = new byte[1];
// 
//     ExtInputStream(InputStream in) {
//       super(in);
//     }
// 
//     public void read(int byteLen) throws IOException {
//       for (int i = 0; i < byteLen; ++i) {
//         super.read(one_byte);
//       }
//     }
// 
//     public String readLine() throws IOException {
//       StringBuilder ret = new StringBuilder();
// 
//       long t = System.currentTimeMillis();
// 
//       while (super.read(one_byte) > 0) {
//         if (one_byte[0] == 0x0d) { // \r
//           break;
//         } else {
//           ret.append((char) one_byte[0]);
//         }
//       }
// 
//       TIME = TIME + (System.currentTimeMillis() - t);
// 
//       super.read(one_byte); // \n
//       return ret.toString();
//     }
//   }
// }


import java.io.IOException;
import jp.co.rakuten.rit.roma.client.ClientException;
import jp.co.rakuten.rit.roma.client.Connection;

      .append(context.get(CommandContext.HASH_NAME))
      .append(STR_CRLF);
    context.put(CommandContext.STRING_DATA, sb);
  }

  @Override
  protected void sendAndReceive(CommandContext context) throws IOException,
      ClientException {
    StringBuilder sb = (StringBuilder) context.get(CommandContext.STRING_DATA);
    Connection conn = (Connection) context.get(CommandContext.CONNECTION);
    conn.out.write(sb.toString().getBytes());
    conn.out.flush();

    sb = new StringBuilder();
    sb.append(conn.in.readLine());
    context.put(CommandContext.STRING_DATA, sb);
  }

  @Override
  protected boolean parseResult(CommandContext context) throws ClientException {
    StringBuilder sb = (StringBuilder) context.get(CommandContext.STRING_DATA);
    String s = sb.toString();
    if (s.startsWith("DELETED")) {
      return true;
    } else if (s.startsWith("NOT_FOUND")) {
      return false;
    } else if (s.startsWith("SERVER_ERROR") || s.startsWith("CLIENT_ERROR")
        || s.startsWith("ERROR")) {
      throw new ClientException(s);
    } else {

// Path: java/client/src/main/java/jp/co/rakuten/rit/roma/client/ClientException.java
// public class ClientException extends Exception {
//   private static final long serialVersionUID = -7032182229500031385L;
// 
//   public ClientException() {
//     super();
//   }
// 
//   public ClientException(Throwable cause) {
//     super(cause);
//   }
// 
//   public ClientException(String reason) {
//     super(reason);
//   }
// 
//   public ClientException(String reason, Throwable cause) {
//     super(reason, cause);
//   }
// }
// 
// Path: java/client/src/main/java/jp/co/rakuten/rit/roma/client/Connection.java
// public class Connection {
//   public Socket sock;
// 
//   public ExtInputStream in;
// 
//   public OutputStream out;
// 
//   /**
//    * Construct a connection to a ROMA process.
//    * 
//    * @param sock
//    *          - a socket of the ROMA process to connect to
//    * @throws IOException
//    *           - if creating this connection fails
//    */
//   public Connection(final Socket sock) throws IOException {
//     this.sock = sock;
//     this.in = new ExtInputStream(sock.getInputStream());
//     this.out = new BufferedOutputStream(sock.getOutputStream());
//   }
// 
//   public void setTimeout(int timeout) throws SocketException {
// 	  this.sock.setSoTimeout(timeout);
//   }
//   
//   /**
//    * Close this connection.
//    * 
//    * @throws IOException
//    *           - if closing this connection fails
//    */
//   public void close() throws IOException {
//     if (in != null) {
//       in.close();
//     }
//     if (out != null) {
//       out.close();
//     }
//     if (sock != null) {
//       sock.close();
//     }
//   }
// 
//   public static long TIME = 0;
// 
//   public class ExtInputStream extends BufferedInputStream {
// 
//     private byte[] one_byte = new byte[1];
// 
//     ExtInputStream(InputStream in) {
//       super(in);
//     }
// 
//     public void read(int byteLen) throws IOException {
//       for (int i = 0; i < byteLen; ++i) {
//         super.read(one_byte);
//       }
//     }
// 
//     public String readLine() throws IOException {
//       StringBuilder ret = new StringBuilder();
// 
//       long t = System.currentTimeMillis();
// 
//       while (super.read(one_byte) > 0) {
//         if (one_byte[0] == 0x0d) { // \r
//           break;
//         } else {
//           ret.append((char) one_byte[0]);
//         }
//       }
// 
//       TIME = TIME + (System.currentTimeMillis() - t);
// 
//       super.read(one_byte); // \n
//       return ret.toString();
//     }
//   }
// }


// Path: java/client/src/main/java/jp/co/rakuten/rit/roma/client/commands/DeleteCommand.java
import java.io.IOException;
import jp.co.rakuten.rit.roma.client.ClientException;
import jp.co.rakuten.rit.roma.client.Connection;

      .append(context.get(CommandContext.HASH_NAME))
      .append(STR_CRLF);
    context.put(CommandContext.STRING_DATA, sb);
  }

  @Override
  protected void sendAndReceive(CommandContext context) throws IOException,
      ClientException {
    StringBuilder sb = (StringBuilder) context.get(CommandContext.STRING_DATA);
    Connection conn = (Connection) context.get(CommandContext.CONNECTION);
    conn.out.write(sb.toString().getBytes());
    conn.out.flush();

    sb = new StringBuilder();
    sb.append(conn.in.readLine());
    context.put(CommandContext.STRING_DATA, sb);
  }

  @Override
  protected boolean parseResult(CommandContext context) throws ClientException {
    StringBuilder sb = (StringBuilder) context.get(CommandContext.STRING_DATA);
    String s = sb.toString();
    if (s.startsWith("DELETED")) {
      return true;
    } else if (s.startsWith("NOT_FOUND")) {
      return false;
    } else if (s.startsWith("SERVER_ERROR") || s.startsWith("CLIENT_ERROR")
        || s.startsWith("ERROR")) {
      throw new ClientException(s);
    } else {

      throw new ClientException("not support yet");
