@Test public void testPostCustomerBodyAndCharset() { httpClientUtils = new HttpClientUtils(); httpClientUtils.initHttpClient(); Logger.info(this, "-------------- HttpClient initialized -------------"); // testPostCustomerBodyAndCharset String resp = ""; try { resp = httpClientUtils.post( "http://localhost:65534/test/testPostCustomerBodyAndCharset", "<?xml version=\"1.0\" encoding=\"GBK\"?><AIPG><INFO>你好</INFO></AIPG>", "GBK"); } catch (IOException e) { Throwable ee = ExceptionUtils.getRootCause(e); if (ee == null) { ee = e; } Logger.error(this, "", ee); Assert.assertTrue(false); // Assert.assertNotSame(NoHttpResponseException.class, ee.getClass()); // Assert.assertSame(SocketException.class, ee.getClass()); // Assert.assertTrue("Connection reset".equals(ee.getMessage()) || "Socket // closed".equals(ee.getMessage()) || "Unexpected end of file from // server".equals(ee.getMessage())); } finally { Logger.info( this, "resp[HttpURLConnection]-[" + testConnectionResetCount + "]=========[" + resp + "]========="); } // Assert.assertEquals(1, testConnectionResetCount); Assert.assertTrue(true); }