@SuppressWarnings("unchecked")
  private void throwServerSideException(String result, String request, String url)
          throws IOException {
    Map<String, String> resultMap = null;
    try {
      resultMap = gson.fromJson(result, Map.class);
    } catch (Exception e) {
      System.out.println("[ERROR] Server side error");
      System.out.println("  Request: " + request);
      System.out.println("  Server URL: " + url);
      System.out.println("  Retry count: " + retryHandler.getRetryCount());
      throw new IOException(new Exception(result));
    }
    String exceptionString = resultMap.get("exception");
    if (exceptionString != null) {
      String[] segs = exceptionString.split(":", 2);
      Exception exception;
      try {
        exception = Class.forName(segs[0]).asSubclass(Exception.class).getConstructor(String.class)
                .newInstance(segs[1]);
      } catch (Exception e) {
        exception = new Exception(exceptionString);
      }
      System.out.println("[ERROR] Server side error");
      System.out.println("  Request: " + request);
      System.out.println("  Server URL: " + url);
      System.out.println("  Retry count: " + retryHandler.getRetryCount());
      throw new IOException(exception);
    }
  }