code: private RESTResponse sendAndReceive(String header, byte[] body) throws IOException {
          // Fail before trying if socket has been closed.
          if (isClosed()) {
              throw new IOException("Socket has been closed");
          }
          
          Exception lastException = null;
          for (int attempt = 0; attempt < MAX_SOCKET_RETRIES; attempt++) {
              try {
                  sendRequest(header, body);
                  return readResponse();
              } catch (IOException e) {
                  // Attempt to reconnect; if this fails, the server's probably down and we
                  // let reconnect's IOException pass through.
                  lastException = e;
                  m_logger.warn("Socket error occurred -- reconnecting", e);
                  reconnect();
              }
          }
          // Here, all reconnects succeeded but retries failed; something else is wrong with
          // the server or the request.
          throw new IOException("Socket error; all retries failed", lastException);
      }
docs: we reconnect and retry up to MAX_SOCKET_RETRIES before giving up.