class AbstractMockRpcProtocol extends AbstractProtocol {
    private static ProviderMessageRouter mockProviderMessageRouter;

    @Override
    protected <T> Exporter<T> createExporter(Provider<T> provider, URL url) {
        Exporter<T> exporter = new MockRpcExporter<T>(provider, url);
        LoggerUtil.info("create MockRpcExporter: url={}", url);
        return exporter;
    }

    @Override
    protected <T> Referer<T> createReferer(Class<T> clz, URL url, URL serviceUrl) {<FILL_FUNCTION_BODY>}

    class MockRpcExporter<T> extends AbstractExporter<T> {
        private Server server;
        private EndpointFactory endpointFactory;

        public MockRpcExporter(Provider<T> provider, URL url) {
            super(provider, url);

            ProviderMessageRouter requestRouter = getMockProviderMessageRouter(url);
            endpointFactory =
                    ExtensionLoader.getExtensionLoader(EndpointFactory.class).getExtension(
                            url.getParameter(URLParamType.endpointFactory.getName(), URLParamType.endpointFactory.getValue()));
            server = endpointFactory.createServer(url, requestRouter);
        }

        @Override
        public void unexport() {
            String protocolKey = MotanFrameworkUtil.getProtocolKey(url);
            Exporter<T> exporter = (Exporter<T>) exporterMap.remove(protocolKey);
            if (exporter != null) {
                exporter.destroy();
            }
        }

        @Override
        public void destroy() {
            endpointFactory.safeReleaseResource(server, url);
            LoggerUtil.info("MockRpcExporter destory Success: url={}", url);
        }

        @Override
        protected boolean doInit() {
            return server.open();
        }

        @Override
        public boolean isAvailable() {
            return server.isAvailable();
        }

    }


    class MockRpcReferer<T> extends AbstractReferer<T> {


        public MockRpcReferer(Class<T> clz, URL url, URL serviceUrl) {
            super(clz, url, serviceUrl);
        }


        @Override
        public void destroy() {
            LoggerUtil.info("MockRpcReferer destroy Success: url={}", url);
        }

        @Override
        protected Response doCall(Request request) {
            return processRequest(request);
        }

        @Override
        protected boolean doInit() {
            LoggerUtil.info("MockRpcReferer init Success: url={}", url);
            return true;
        }

    }

    // process all urls。
    public ProviderMessageRouter getMockProviderMessageRouter(URL url) {
        if (mockProviderMessageRouter == null) {
            //default
            mockProviderMessageRouter = new MockProviderMessageRouter();
        }

        return mockProviderMessageRouter;
    }

    class MockProviderMessageRouter extends ProviderMessageRouter {

        @Override
        public Object handle(Channel channel, Object message) {
            if (channel == null || message == null) {
                throw new MotanFrameworkException("RequestRouter handler(channel, message) params is null");
            }

            if (!(message instanceof Request)) {
                throw new MotanFrameworkException("RequestRouter message type not support: " + message.getClass());
            }
            return processRequest((Request) message);
        }

    }

    /**
     * process request. request is mock processed by client or server
     * 
     * @param request
     * @return
     */
    protected abstract Response processRequest(Request request);

}

        Referer<T> referer = new MockRpcReferer<T>(clz, url, serviceUrl);
        LoggerUtil.info("create MockRpcReferer: url={}", url);
        return referer;
    
<methods>public non-sealed void <init>() ,public void destroy() ,public Exporter<T> export(Provider<T>, com.weibo.api.motan.rpc.URL) ,public Map<java.lang.String,Exporter<?>> getExporterMap() ,public Referer<T> refer(Class<T>, com.weibo.api.motan.rpc.URL) ,public Referer<T> refer(Class<T>, com.weibo.api.motan.rpc.URL, com.weibo.api.motan.rpc.URL) <variables>protected ConcurrentHashMap<java.lang.String,Exporter<?>> exporterMap