@Test
public void testInterceptorOrder() throws Exception {

    AtomicInteger ai = new AtomicInteger();
    OrderCheckInterceptor interceptor1 = new OrderCheckInterceptor(ai);
    OrderCheckInterceptor interceptor2 = new OrderCheckInterceptor(ai);
    final TTransport transport = new FlushableMemoryBuffer(4096);
    com.meituan.firefly.testfirefly.TestService testService = thrift.create(com.meituan.firefly.testfirefly.TestService.class, new Thrift.SimpleTProtocolFactory() {
        @Override
        public TProtocol get() {
            return new TBinaryProtocol(transport);
        }
    }, interceptor1, interceptor2);
    NotifyCheck notifyCheck = new NotifyCheck(100);
    com.meituan.firefly.testthrift.TestService.Processor<Iface> processor = new com.meituan.firefly.testthrift.TestService.Processor<Iface>(notifyCheck);
    testService.notify(100);
    processor.process(new TBinaryProtocol(transport), new TBinaryProtocol(transport));
    Assert.assertTrue(notifyCheck.notified);
    Assertions.assertThat(new int[]{interceptor2.inorder, interceptor1.inorder, interceptor1.outorder, interceptor2.outorder}).isEqualTo(new int[]{0, 1, 2, 3});
}