@Test
 public void testSerializationDeserialization() throws IOException {
   ErrorDetail detail =
       new AdapterUnauthorizedErrorDetail("Unauthorized adapter access", "vdr", "Basic");
   HttpError error = new HttpError(401, "Unauthorized", detail);
   String jsonError = mapper.writeValueAsString(error);
   System.out.println(jsonError);
   Assert.assertTrue(
       "Serialization should be successful",
       jsonError.contains("Unauthorized") && jsonError.contains("Basic"));
   HttpError readError = mapper.readValue(jsonError, HttpError.class);
   Assert.assertEquals(
       "Deserialization of the HttpError should be successful",
       "Unauthorized",
       readError.getMessage());
   Assert.assertEquals(
       "Deserialization of the AdapterUnauthorizedErrorDetail should be successful",
       "Basic",
       ((AdapterUnauthorizedErrorDetail) readError.getDetails().get(0)).getAuthorization());
 }
  /**
   * @description:成功后调用
   * @author:hc
   * @return:void
   * @param arg2
   */
  @Override
  public void onSuccess(String result) {

    Gson gson = new Gson();

    LogUtils.d("结果是: %s", result);

    try {
      if (success != null) success.onSuccess(gson.fromJson(result, cls));
    } catch (JsonSyntaxException e) {

      if (error != null) error.onError(e);
    }
  }
 /**
  * @description:失败后调用
  * @author:hc
  * @return:void
  * @param arg3
  */
 @Override
 public void onFailure(Throwable throwable) {
   if (error != null) error.onError(throwable);
 }