@@ -0,0 +1,1906 @@
+package util;%0A%0A%0Aimport okhttp3.*;%0A%0Aimport java.io.IOException;%0Aimport java.util.Date;%0Aimport java.util.List;%0A%0A/**%0A * Intercepts HTTP requests and returns mock responses for unit testing.%0A */%0Apublic class MockInterceptor implements Interceptor %7B%0A    public static String TEST_FILENAME = %22filestack_test.txt%22;%0A    public static String TEST_FILE_CONTENT = %22Test content for handle: %25s%5Cn%25s%5Cn%22;%0A    public static String TEST_FILE_TYPE = %22text/plain; charset=utf-8%22;%0A%0A    public static String HEADER_FILENAME = %22x-file-name%22;%0A%0A    public static String MESSAGE_OK = %22OK%22;%0A%0A    @Override%0A    public Response intercept(Chain chain) throws IOException %7B%0A        HttpUrl url = chain.request().url();%0A        Response.Builder builder = null;%0A%0A        String host = url.host();%0A        List%3CString%3E path = url.pathSegments();%0A        String query = url.query();%0A%0A        if (CdnService.URL.contains(host)) %7B%0A            if (path.size() == 1) %7B%0A                String handle = path.get(0);%0A                builder = genGetResponse(handle);%0A            %7D%0A        %7D%0A%0A        if (builder == null)%0A            throw new IOException(%22The request was not matched by the interceptor%22);%0A%0A        return builder%0A                .protocol(Protocol.HTTP_1_1)%0A                .request(chain.request())%0A                .build();%0A    %7D%0A%0A    /**%0A     * Generates a test response for get requests.%0A     * Response contains data for a simple text file.%0A     *%0A     * @param handle File handle / id%0A     */%0A    private Response.Builder genGetResponse(String handle) %7B%0A        String bodyText = String.format(TEST_FILE_CONTENT, handle, new Date());%0A        ResponseBody body = ResponseBody.create(MediaType.parse(TEST_FILE_TYPE), bodyText);%0A        return new Response.Builder()%0A                .addHeader(HEADER_FILENAME, TEST_FILENAME)%0A                .body(body)%0A                .code(200)%0A                .message(MESSAGE_OK);%0A    %7D%0A%7D%0A

Add http interceptor for unit testing.