mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
16
hutool-http/src/test/java/cn/hutool/http/MockServerTest.java
Executable file
16
hutool-http/src/test/java/cn/hutool/http/MockServerTest.java
Executable 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);
|
||||
}
|
||||
}
|
22
hutool-http/src/test/java/cn/hutool/http/client/JdkEngineTest.java
Executable file
22
hutool-http/src/test/java/cn/hutool/http/client/JdkEngineTest.java
Executable 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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user