Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rujun Chen authored Nov 23, 2021
1 parent 7610e84 commit 7ea503b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.apache.http.client.methods.HttpPost;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
Expand Down Expand Up @@ -129,6 +130,7 @@ private static CloseableHttpClient buildClient() {

PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(
RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", sslConnectionSocketFactory)
.build());
return HttpClients.custom().setConnectionManager(manager).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ public void getUserAgentPrefixTest() {

@Test
@Disabled("Disable this because it will cause pipeline failure: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1196171&view=logs&j=4a83f3be-c53d-53dd-7954-86872056fb11&t=54174aae-5a55-579d-08e2-94fb446f7b77&l=29")
public void testCustomizedHttpsClient() {
public void testHttpUtilGet() {
String url = "https://mvnrepository.com/";
String result = HttpUtil.get(url, null);
assertNotNull(result);
assertFalse(result.isEmpty());
}

@Test
@Disabled("This is only used to test in localhost manually")
public void testHttpUtilGet1() {
String url = "http://localhost:8000/";
String result = HttpUtil.get(url, null);
assertNotNull(result);
assertFalse(result.isEmpty());
}
}

0 comments on commit 7ea503b

Please sign in to comment.