List of usage examples for org.apache.http.entity InputStreamEntity isRepeatable
public boolean isRepeatable()
From source file:com.hortonworks.registries.auth.client.AuthenticatorTestCase.java
protected void _testAuthenticationHttpClient(Authenticator authenticator, boolean doPost) throws Exception { start();// www . j av a 2s . c o m try { SystemDefaultHttpClient httpClient = getHttpClient(); doHttpClientRequest(httpClient, new HttpGet(getBaseURL())); // Always do a GET before POST to trigger the SPNego negotiation if (doPost) { HttpPost post = new HttpPost(getBaseURL()); byte[] postBytes = POST.getBytes(); ByteArrayInputStream bis = new ByteArrayInputStream(postBytes); InputStreamEntity entity = new InputStreamEntity(bis, postBytes.length); // Important that the entity is not repeatable -- this means if // we have to renegotiate (e.g. b/c the cookie wasn't handled properly) // the test will fail. Assert.assertFalse(entity.isRepeatable()); post.setEntity(entity); doHttpClientRequest(httpClient, post); } } finally { stop(); } }