General tidy

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1571453 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2014-02-24 21:40:41 +00:00
parent 9c666a3c9f
commit 2bbfeb5bf7
4 changed files with 10 additions and 4 deletions

View File

@ -82,7 +82,7 @@ public class TestSSLContextBuilder {
final KeyStore keystore = load("test-keypasswd.keystore", "nopassword".toCharArray()); final KeyStore keystore = load("test-keypasswd.keystore", "nopassword".toCharArray());
final String keyPassword = "password"; final String keyPassword = "password";
new SSLContextBuilder() new SSLContextBuilder()
.loadKeyMaterial(keystore, keyPassword != null ? keyPassword.toCharArray() : null) .loadKeyMaterial(keystore, keyPassword.toCharArray())
.loadTrustMaterial(keystore) .loadTrustMaterial(keystore)
.build(); .build();
} }
@ -92,7 +92,7 @@ public class TestSSLContextBuilder {
final KeyStore keystore = load("test-keypasswd.keystore", "nopassword".toCharArray()); final KeyStore keystore = load("test-keypasswd.keystore", "nopassword".toCharArray());
final String keyPassword = "!password"; final String keyPassword = "!password";
new SSLContextBuilder() new SSLContextBuilder()
.loadKeyMaterial(keystore, keyPassword != null ? keyPassword.toCharArray() : null) .loadKeyMaterial(keystore, keyPassword.toCharArray())
.loadTrustMaterial(keystore) .loadTrustMaterial(keystore)
.build(); .build();
} }

View File

@ -107,6 +107,9 @@ public class TestCookieVirtualHost extends IntegrationTestBase {
response.setStatusLine(HttpVersion.HTTP_1_1, response.setStatusLine(HttpVersion.HTTP_1_1,
HttpStatus.SC_OK); HttpStatus.SC_OK);
break; break;
default:
Assert.fail("Unexpected value: " + n);
break;
} }
} }
@ -122,6 +125,7 @@ public class TestCookieVirtualHost extends IntegrationTestBase {
URI uri = new URI("http://app.mydomain.fr"); URI uri = new URI("http://app.mydomain.fr");
HttpRequest httpRequest = new HttpGet(uri); HttpRequest httpRequest = new HttpGet(uri);
httpRequest.addHeader("X-Request", "1"); httpRequest.addHeader("X-Request", "1");
@SuppressWarnings("resource")
final HttpResponse response1 = this.httpclient.execute(getServerHttp(), final HttpResponse response1 = this.httpclient.execute(getServerHttp(),
httpRequest, context); httpRequest, context);
final HttpEntity e1 = response1.getEntity(); final HttpEntity e1 = response1.getEntity();
@ -137,6 +141,7 @@ public class TestCookieVirtualHost extends IntegrationTestBase {
uri = new URI("http://app.mydomain.fr"); uri = new URI("http://app.mydomain.fr");
httpRequest = new HttpGet(uri); httpRequest = new HttpGet(uri);
httpRequest.addHeader("X-Request", "2"); httpRequest.addHeader("X-Request", "2");
@SuppressWarnings("resource")
final HttpResponse response2 = this.httpclient.execute(getServerHttp(), final HttpResponse response2 = this.httpclient.execute(getServerHttp(),
httpRequest, context); httpRequest, context);
final HttpEntity e2 = response2.getEntity(); final HttpEntity e2 = response2.getEntity();
@ -146,6 +151,7 @@ public class TestCookieVirtualHost extends IntegrationTestBase {
uri = new URI("http://app.mydomain.fr"); uri = new URI("http://app.mydomain.fr");
httpRequest = new HttpGet(uri); httpRequest = new HttpGet(uri);
httpRequest.addHeader("X-Request", "3"); httpRequest.addHeader("X-Request", "3");
@SuppressWarnings("resource")
final HttpResponse response3 = this.httpclient.execute(getServerHttp(), final HttpResponse response3 = this.httpclient.execute(getServerHttp(),
httpRequest, context); httpRequest, context);
final HttpEntity e3 = response3.getEntity(); final HttpEntity e3 = response3.getEntity();

View File

@ -30,7 +30,6 @@ package org.apache.http.impl.conn;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;

View File

@ -46,6 +46,7 @@ import org.apache.http.protocol.HttpContext;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.Mockito; import org.mockito.Mockito;
/** /**
@ -76,7 +77,7 @@ public class TestSystemDefaultRoutePlanner {
Assert.assertEquals(target, route.getTargetHost()); Assert.assertEquals(target, route.getTargetHost());
Assert.assertEquals(1, route.getHopCount()); Assert.assertEquals(1, route.getHopCount());
Assert.assertFalse(route.isSecure()); Assert.assertFalse(route.isSecure());
Mockito.verify(schemePortResolver, Mockito.never()).resolve(Mockito.<HttpHost>any()); Mockito.verify(schemePortResolver, Mockito.never()).resolve(Matchers.<HttpHost>any());
} }
@Test @Test