### Question:
BaseHttpStack implements HttpStack { @Deprecated @Override public final org.apache.http.HttpResponse performRequest( Request<?> request, Map<String, String> additionalHeaders) throws IOException, AuthFailureError { HttpResponse response = executeRequest(request, additionalHeaders); ProtocolVersion protocolVersion = new ProtocolVersion("HTTP", 1, 1); StatusLine statusLine = new BasicStatusLine( protocolVersion, response.getStatusCode(), "" ); BasicHttpResponse apacheResponse = new BasicHttpResponse(statusLine); List<org.apache.http.Header> headers = new ArrayList<>(); for (Header header : response.getHeaders()) { headers.add(new BasicHeader(header.getName(), header.getValue())); } apacheResponse.setHeaders(headers.toArray(new org.apache.http.Header[headers.size()])); InputStream responseStream = response.getContent(); if (responseStream != null) { BasicHttpEntity entity = new BasicHttpEntity(); entity.setContent(responseStream); entity.setContentLength(response.getContentLength()); apacheResponse.setEntity(entity); } return apacheResponse; }  abstract HttpResponse executeRequest(
            Request<?> request, Map<String, String> additionalHeaders); @Deprecated @Override final org.apache.http.HttpResponse performRequest(
            Request<?> request, Map<String, String> additionalHeaders);  }### Answer:
@Test public void legacyRequestWithoutBody() throws Exception { BaseHttpStack stack = new BaseHttpStack() { @Override public HttpResponse executeRequest( Request<?> request, Map<String, String> additionalHeaders) throws IOException, AuthFailureError { assertSame(REQUEST, request); assertSame(ADDITIONAL_HEADERS, additionalHeaders); return new HttpResponse(12345, Collections.<Header>emptyList()); } }; org.apache.http.HttpResponse resp = stack.performRequest(REQUEST, ADDITIONAL_HEADERS); assertEquals(12345, resp.getStatusLine().getStatusCode()); assertEquals(0, resp.getAllHeaders().length); assertNull(resp.getEntity()); }
@Test public void legacyResponseWithBody() throws Exception { BaseHttpStack stack = new BaseHttpStack() { @Override public HttpResponse executeRequest( Request<?> request, Map<String, String> additionalHeaders) throws IOException, AuthFailureError { assertSame(REQUEST, request); assertSame(ADDITIONAL_HEADERS, additionalHeaders); return new HttpResponse( 12345, Collections.<Header>emptyList(), 555, mContent); } }; org.apache.http.HttpResponse resp = stack.performRequest(REQUEST, ADDITIONAL_HEADERS); assertEquals(12345, resp.getStatusLine().getStatusCode()); assertEquals(0, resp.getAllHeaders().length); assertEquals(555L, resp.getEntity().getContentLength()); assertSame(mContent, resp.getEntity().getContent()); }
@Test public void legacyResponseHeaders() throws Exception { BaseHttpStack stack = new BaseHttpStack() { @Override public HttpResponse executeRequest( Request<?> request, Map<String, String> additionalHeaders) throws IOException, AuthFailureError { assertSame(REQUEST, request); assertSame(ADDITIONAL_HEADERS, additionalHeaders); List<Header> headers = new ArrayList<>(); headers.add(new Header("HeaderA", "ValueA")); headers.add(new Header("HeaderB", "ValueB_1")); headers.add(new Header("HeaderB", "ValueB_2")); return new HttpResponse(12345, headers); } }; org.apache.http.HttpResponse resp = stack.performRequest(REQUEST, ADDITIONAL_HEADERS); assertEquals(12345, resp.getStatusLine().getStatusCode()); assertEquals(3, resp.getAllHeaders().length); assertEquals("HeaderA", resp.getAllHeaders()[0].getName()); assertEquals("ValueA", resp.getAllHeaders()[0].getValue()); assertEquals("HeaderB", resp.getAllHeaders()[1].getName()); assertEquals("ValueB_1", resp.getAllHeaders()[1].getValue()); assertEquals("HeaderB", resp.getAllHeaders()[2].getName()); assertEquals("ValueB_2", resp.getAllHeaders()[2].getValue()); assertNull(resp.getEntity()); }