Test to demonstrate NPE in DefaultRequestDirector
When the HTTP client encountered a server failure while talking through a proxy, it fails with an NullPointerException and not an IOException. Change-Id: I4b287105bf78b832d034557e37e74ce576c7894d Bug: http://b/5372438
This commit is contained in:
@@ -219,6 +219,23 @@ public abstract class AbstractProxyTest extends TestCase {
|
||||
assertEquals("GET /bar HTTP/1.1", recordedRequest.getRequestLine());
|
||||
}
|
||||
|
||||
// http://b/5372438
|
||||
public void testRetryWithProxy() throws Exception {
|
||||
server.enqueue(new MockResponse()
|
||||
.setSocketPolicy(SocketPolicy.DISCONNECT_AT_START));
|
||||
server.play();
|
||||
|
||||
HttpClient httpProxyClient = newHttpClient();
|
||||
HttpGet request = new HttpGet("http://android.com/foo");
|
||||
ProxyConfig.REQUEST_PARAMETER.configure(server, httpProxyClient, request);
|
||||
|
||||
try {
|
||||
httpProxyClient.execute(request);
|
||||
fail();
|
||||
} catch (IOException expected) {
|
||||
}
|
||||
}
|
||||
|
||||
enum ProxyConfig {
|
||||
PROXY_SYSTEM_PROPERTY() {
|
||||
@Override void configure(MockWebServer server, HttpClient client, HttpRequest request) {
|
||||
|
||||
Reference in New Issue
Block a user