+ httpClient.close();
+ EasyMock.expectLastCall();
+
+ PowerMock.replayAll();
+
+
+ String url = "localhost";
+ Map<String, String> header = new HashMap<>();
+ header.put("accept", "application/json");
+ Map<String, String> para = new HashMap<>();
+ para.put("tset", "1111");
+
+ HttpEntity entity = new StringEntity("Test");
+ HttpResponse httpResponse = HttpsUtils.post(url, header, para, entity);
+ String res = HttpsUtils.extractResponseEntity(httpResponse);
+
+ PowerMock.verifyAll();
+
+ assertThat(res, equalTo("Test"));
+ }
+
+ @Test
+ public void testHttpsUtil_put_excepiton() throws Exception {
+ thrown.expect(CorrelationException.class);
+ thrown.expectMessage("Failed to query data from server through PUT method!");
+ String url = "host";
+ Map<String, String> header = new HashMap<>();
+ header.put("accept", "application/json");
+ Map<String, String> para = new HashMap<>();
+ para.put("tset", "1111");
+
+ HttpResponse httpResponse = HttpsUtils.put(url, header, para, null);
+ String response = HttpsUtils.extractResponseEntity(httpResponse);
+ assertThat(response, equalTo(""));
+ }
+
+ @Test
+ public void testHttpsUtil_put_normal() throws Exception {
+ HttpClientBuilder hcb = PowerMock.createMock(HttpClientBuilder.class);
+ CloseableHttpClient httpClient = PowerMock.createMock(CloseableHttpClient.class);
+ PowerMock.mockStatic(HttpClients.class);
+ EasyMock.expect(HttpClients.custom()).andReturn(hcb);
+ EasyMock.expect(hcb.setDefaultRequestConfig(EasyMock.anyObject(RequestConfig.class))).andReturn(hcb);
+ EasyMock.expect(hcb.setSSLSocketFactory(EasyMock.anyObject(SSLConnectionSocketFactory.class))).andReturn(hcb);
+ EasyMock.expect(hcb.setConnectionManager(EasyMock.anyObject(PoolingHttpClientConnectionManager.class))).andReturn(hcb);
+ EasyMock.expect(hcb.setConnectionManagerShared(true)).andReturn(hcb);
+ EasyMock.expect(hcb.build()).andReturn(httpClient);
+
+ CloseableHttpResponse response = PowerMock.createMock(CloseableHttpResponse.class);
+ EasyMock.expect(httpClient.execute(EasyMock.anyObject(HttpRequestBase.class))).andReturn(response);
+ StatusLine sl = PowerMock.createMock(StatusLine.class);
+ EasyMock.expect(response.getStatusLine()).andReturn(sl);
+ EasyMock.expect(sl.getStatusCode()).andReturn(HttpStatus.SC_OK);
+ HttpEntity responseEntity = new StringEntity("Test");
+ EasyMock.expect(response.getEntity()).andReturn(responseEntity);
+
+ httpClient.close();
+ EasyMock.expectLastCall();
+