This commit is contained in:
Looly
2022-10-27 13:48:57 +08:00
parent f189c5e027
commit e1a2eaafa6
14 changed files with 279 additions and 246 deletions

View File

@@ -0,0 +1,16 @@
package cn.hutool.http;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import java.io.IOException;
public class MockServerTest {
public static void main(final String[] args) throws IOException {
//noinspection resource
final MockWebServer server = new MockWebServer();
final MockResponse mockResponse = new MockResponse().setBody("hello, world!");
server.enqueue(mockResponse);
server.start(8080);
}
}

View File

@@ -0,0 +1,22 @@
package cn.hutool.http.client;
import cn.hutool.core.lang.Console;
import cn.hutool.http.client.engine.jdk.JdkClientEngine;
import cn.hutool.http.meta.Method;
import org.junit.Ignore;
import org.junit.Test;
public class JdkEngineTest {
@Test
@Ignore
public void getTest(){
final ClientEngine engine = new JdkClientEngine();
final Request req = Request.of("https://www.hutool.cn/").method(Method.GET);
final Response res = engine.send(req);
Console.log(res.getStatus());
Console.log(res.bodyStr());
}
}