本文整理了Java中com.squareup.okhttp.mockwebserver.MockWebServer.setDispatcher()
方法的一些代码示例,展示了MockWebServer.setDispatcher()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MockWebServer.setDispatcher()
方法的具体详情如下:
包路径:com.squareup.okhttp.mockwebserver.MockWebServer
类名称:MockWebServer
方法名:setDispatcher
[英]Sets the dispatcher used to match incoming requests to mock responses. The default dispatcher simply serves a fixed sequence of responses from a #enqueue(MockResponse); custom dispatchers can vary the response based on timing or the content of the request.
[中]设置用于将传入请求与模拟响应匹配的调度程序。默认的调度程序只是为来自#排队(MockResponse)的固定响应序列提供服务;自定义调度器可以根据时间或请求内容更改响应。
代码示例来源:origin: cfg4j/cfg4j
private void runMockServer() throws IOException {
server = new MockWebServer();
server.setDispatcher(dispatcher);
server.start(0);
}
}
代码示例来源:origin: cfg4j/cfg4j
private void runMockServer() throws IOException {
server = new MockWebServer();
server.setDispatcher(dispatcher);
server.start(0);
}
}
代码示例来源:origin: apache/jclouds
/**
* Creates a {@link MockWebServer} that uses the given {@link Dispatcher}.
*/
protected static MockWebServer mockWebServer(Dispatcher dispatcher) throws IOException {
MockWebServer server = new MockWebServer();
server.play();
server.setDispatcher(dispatcher);
return server;
}
代码示例来源:origin: apache/jclouds
public static MockWebServer mockOpenStackServer() throws IOException {
MockWebServer server = new MockWebServer();
server.play();
URL url = server.getUrl("");
server.setDispatcher(getURLReplacingQueueDispatcher(url));
return server;
}
代码示例来源:origin: apache/jclouds
server.setDispatcher(new Dispatcher() {
@Override public MockResponse dispatch(RecordedRequest recordedRequest) {
return new MockResponse();
内容来源于网络,如有侵权,请联系作者删除!