@Test public void testGet_FormsCorrectRequest_withBasicAuth() throws Exception { Robolectric.addPendingHttpResponse(200, "OK"); http.get("www.example.com", new HashMap<String, String>(), "username", "password"); HttpRequestInfo sentHttpRequestData = Robolectric.getSentHttpRequestInfo(0); CredentialsProvider credentialsProvider = (CredentialsProvider) sentHttpRequestData.getHttpContext().getAttribute(ClientContext.CREDS_PROVIDER); assertThat(credentialsProvider.getCredentials(AuthScope.ANY).getUserPrincipal().getName(), equalTo("username")); assertThat(credentialsProvider.getCredentials(AuthScope.ANY).getPassword(), equalTo("password")); }
public Response get(String url, Map<String, String> headers, String username, String password) throws IOException, URISyntaxException { URI uri = new URI(url); return makeRequest(headers, username, password, new HttpGet(uri), uri.getHost()); }
Http { public Response get(String url, Map<String, String> headers, String username, String password) throws IOException, URISyntaxException { URI uri = new URI(url); return makeRequest(headers, username, password, new HttpGet(uri), uri.getHost()); } }
Http { public Response get(String url, Map<String, String> headers, String username, String password) throws IOException, URISyntaxException { URI uri = new URI(url); return makeRequest(headers, username, password, new HttpGet(uri), uri.getHost()); }  }
Http { public Response get(String url, Map<String, String> headers, String username, String password) throws IOException, URISyntaxException { URI uri = new URI(url); return makeRequest(headers, username, password, new HttpGet(uri), uri.getHost()); }  Response get(String url, Map<String, String> headers, String username, String password); Response post(String url, Map<String, String> headers, String postBody, String username, String password); }
Http { public Response get(String url, Map<String, String> headers, String username, String password) throws IOException, URISyntaxException { URI uri = new URI(url); return makeRequest(headers, username, password, new HttpGet(uri), uri.getHost()); }  Response get(String url, Map<String, String> headers, String username, String password); Response post(String url, Map<String, String> headers, String postBody, String username, String password);  }