public static Collection<Interceptor> all() {
    List<Interceptor> interceptors =
        new ArrayList<>(
            asList(
                new LinkedHashMapEldestInterceptor(),
                new SystemTimeInterceptor(),
                new SystemArrayCopyInterceptor(),
                new LocaleAdjustLanguageCodeInterceptor(),
                new SystemLogInterceptor(),
                new FileDescriptorInterceptor(),
                new NoOpInterceptor(),
                new SocketInterceptor(),
                new ReferenceRefersToInterceptor(),
                new NioUtilsFreeDirectBufferInterceptor()));

    if (Util.getJavaVersion() >= 9) {
      interceptors.add(new CleanerInterceptor());
    }

    return interceptors;
  }
@Test
  public void testNioUtilsFreeDirectBufferInterceptor()
      throws NoSuchMethodException, IllegalAccessException {

    Interceptors interceptors = new Interceptors(AndroidInterceptors.all());
    Interceptor interceptor = interceptors.findInterceptor("java.nio.NioUtils", "freeDirectBuffer");
    assertThat(interceptor).isNotNull();

    MethodHandle methodHandle =
        interceptor.getMethodHandle(
            "freeDirectBuffer",
            MethodType.methodType(void.class, new Class<?>[] {ByteBuffer.class}));
    assertThat(methodHandle).isNotNull();

    Function<Object, Object> function =
        interceptor.handle(
            MethodSignature.parse("java.nio.NioUtils/freeDirectBuffer(Ljava.nio.ByteBuffer;)V"));
    assertThat(function).isNotNull();
    // Actual invocation is a no-op.
    function.call(/* theClass= */ null, ByteBuffer.allocate(0), /* params= */ null);
  }