package org.knowm.xchange.interceptor;

import com.google.common.base.Suppliers;
import java.util.Collection;
import java.util.ServiceLoader;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import si.mazi.rescu.Interceptor;

public class InterceptorProvider {

  private static final Supplier<Collection<Interceptor>> INTERCEPTORS_SUPPLIER =
      Suppliers.memoize(
          () -> {
            final ServiceLoader<Interceptor> serviceLoader = ServiceLoader.load(Interceptor.class);
            return StreamSupport.stream(serviceLoader.spliterator(), false)
                .collect(Collectors.toSet());
          });

  public static Collection<Interceptor> provide() {
    return INTERCEPTORS_SUPPLIER.get();
  }
}

@@ -317,16 +317,18 @@
 ider %7B%0A%0A
+  
   privat
@@ -400,16 +400,22 @@
 PLIER =%0A
+      
       Su
@@ -431,16 +431,26 @@
 emoize(%0A
+          
         
@@ -471,16 +471,28 @@
         
+  
+          
 final Se
@@ -579,24 +579,36 @@
             
+         
+   
 return Strea
@@ -659,16 +659,32 @@
  false)%0A
+                
         
@@ -721,16 +721,26 @@
 Set());%0A
+          
         
@@ -746,16 +746,18 @@
    %7D);%0A%0A
+  
   public
@@ -800,16 +800,20 @@
 ide() %7B%0A
+    
     retu
@@ -848,10 +848,11 @@
 ();%0A
+  
   %7D%0A%7D
-%0A

Add possibility to use custom Interceptors