public String send(String command,boolean retry) throws Exception {
  ChannelResult result=null;
  while (true) {
    try {
      if (socket == null || wr == null) {
        connect();
      }
      wr.write(command + "\n");
      wr.flush();
      String response=rd.readLine();
      if (response == null) {
        throw new EOFException(command);
      }
      result=new ChannelResult(response);
      break;
    }
 catch (    EOFException e) {
      throw e;
    }
catch (    Exception e) {
      close();
      if (!retry) {
        return null;
      }
      try {
        Thread.sleep(1000);
      }
 catch (      Exception e2) {
        logger.error(e2.getMessage(),e2);
      }
    }
  }
  if (!result.success) {
    throw new Exception(String.format("[%s:%d] %s -> %s",host,port,command,result.message));
  }
  return result.message;
}

public String send ( String command , boolean retry ) throws Exception { ChannelResult result = null ; while ( true ) { try { if ( socket == null || wr == null ) { connect ( ) ; } wr . write ( command + "\n" ) ; wr . flush ( ) ; String response = rd . readLine ( ) ; if ( response == null ) { throw new EOFException ( command ) ; } result = new ChannelResult ( response ) ; break ; } catch ( EOFException e ) { throw e ; } catch ( Exception e ) { close ( ) ; if ( ! retry ) { return null ; } try { Thread . sleep ( 1000 ) ; } catch ( Exception e2 ) { logger . error ( e2 . getMessage ( ) , e2 ) ; } } } if ( ! result . success ) { throw new Exception ( String . format ( "[%s:%d] %s -> %s" , host , port , command , result . message ) ) ; } return result . message ; }
blocks until the command is successfully sent to the remote process . if the connection to the remote process fails , this method will continuously attempt to reestablish the connection .
