org.eclipse.jetty.client.api.ContentResponse Java Examples
The following examples show how to use
org.eclipse.jetty.client.api.ContentResponse.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CloudStoreTest.java From athenz with Apache License 2.0 | 7 votes |
@Test public void testFetchRoleCredentialInvalidCreds() throws InterruptedException, ExecutionException, TimeoutException { CloudStore store = new CloudStore(); store.awsRole = "athenz.zts"; HttpClient httpClient = Mockito.mock(HttpClient.class); ContentResponse response = Mockito.mock(ContentResponse.class); Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.getContentAsString()).thenReturn("invalid-creds"); store.setHttpClient(httpClient); Mockito.when(httpClient.GET("http://169.254.169.254/latest/meta-data/iam/security-credentials/athenz.zts")).thenReturn(response); assertFalse(store.fetchRoleCredentials()); store.close(); }
Example #2
Source File: WebClientFactoryImplTest.java From openhab-core with Eclipse Public License 2.0 | 6 votes |
@Test @Ignore("connecting to the outside world makes this test flaky") public void testCommonClientUsesExtensibleTrustManager() throws Exception { ArgumentCaptor<X509Certificate[]> certificateChainCaptor = ArgumentCaptor.forClass(X509Certificate[].class); ArgumentCaptor<SSLEngine> sslEngineCaptor = ArgumentCaptor.forClass(SSLEngine.class); HttpClient httpClient = webClientFactory.getCommonHttpClient(); ContentResponse response = httpClient.GET(TEST_URL); if (response.getStatus() != 200) { fail("Statuscode != 200"); } verify(extensibleTrustManager).checkServerTrusted(certificateChainCaptor.capture(), anyString(), sslEngineCaptor.capture()); verifyNoMoreInteractions(extensibleTrustManager); assertThat(sslEngineCaptor.getValue().getPeerHost(), is("www.eclipse.org")); assertThat(sslEngineCaptor.getValue().getPeerPort(), is(443)); assertThat(certificateChainCaptor.getValue()[0].getSubjectX500Principal().getName(), containsString("eclipse.org")); }
Example #3
Source File: JsonRpcCallExceptionDecoder.java From ja-micro with Apache License 2.0 | 6 votes |
@Override public RpcCallException decodeException(ContentResponse response) throws RpcCallException { try { if (response != null) { JsonObject json = (JsonObject) new JsonParser().parse(response.getContentAsString()); JsonElement error = json.get("error"); if (error != null) { return RpcCallException.fromJson(error.toString()); } } } catch (Exception ex) { logger.warn("Caught exception decoding protobuf response exception", ex); throw new RpcCallException(RpcCallException.Category.InternalServerError, RpcCallExceptionDecoder.exceptionToString(ex)); } return null; }
Example #4
Source File: HttpOperatorFactory.java From digdag with Apache License 2.0 | 6 votes |
private TaskResult run(HttpClient httpClient) { Optional<String> secretUri = httpSecrets.getSecretOptional("uri"); String rawUri; boolean uriIsSecret; if (secretUri.isPresent()) { uriIsSecret = true; rawUri = secretUri.get(); } else { UserSecretTemplate uriTemplate = UserSecretTemplate.of(params.get("_command", String.class)); uriIsSecret = uriTemplate.containsSecrets(); rawUri = uriTemplate.format(context.getSecrets()); } URI uri = URI.create(rawUri); boolean storeContent = params.get("store_content", boolean.class, false); ContentResponse response = runHttp(httpClient, uri, uriIsSecret); return result(response, storeContent); }
Example #5
Source File: CloudStoreTest.java From athenz with Apache License 2.0 | 6 votes |
@Test public void testFetchRoleCredential() throws InterruptedException, ExecutionException, TimeoutException { CloudStore store = new CloudStore(); store.awsRole = "athenz.zts"; HttpClient httpClient = Mockito.mock(HttpClient.class); ContentResponse response = Mockito.mock(ContentResponse.class); Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.getContentAsString()).thenReturn("{\"AccessKeyId\":\"id\",\"SecretAccessKey\":\"key\",\"Token\":\"token\"}"); store.setHttpClient(httpClient); Mockito.when(httpClient.GET("http://169.254.169.254/latest/meta-data/iam/security-credentials/athenz.zts")).thenReturn(response); assertTrue(store.fetchRoleCredentials()); store.close(); }
Example #6
Source File: RpcClient.java From ja-micro with Apache License 2.0 | 6 votes |
public RESPONSE callSynchronous(Message request, OrangeContext orangeContext) throws RpcCallException { HttpClientWrapper clientWrapper = loadBalancer.getHttpClientWrapper(); HttpRequestWrapper balancedPost = clientWrapper.createHttpPost(this); //set custom headers if (orangeContext != null) { orangeContext.getProperties().forEach(balancedPost::setHeader); } balancedPost.setHeader("Content-type", TYPE_OCTET); //TODO: fix: Temporary workaround below until go services are more http compliant balancedPost.setHeader("Connection", "close"); ProtobufRpcRequest pbRequest = new ProtobufRpcRequest(methodName, request); byte[] protobufData = pbRequest.getProtobufData(); balancedPost.setContentProvider(new BytesContentProvider(protobufData)); logger.debug("Sending request of size {}", protobufData.length); ContentResponse rpcResponse = clientWrapper.execute(balancedPost, new ProtobufRpcCallExceptionDecoder(), orangeContext); byte[] data = rpcResponse.getContent(); logger.debug("Received a proto response of size: {}", data.length); return ProtobufUtil.byteArrayToProtobuf( new ProtobufRpcResponse(data).getPayloadData(), responseClass); }
Example #7
Source File: HttpCertSignerTest.java From athenz with Apache License 2.0 | 6 votes |
@Test public void testGenerateX509CertificateResponseEmpty() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); HttpCertSignerFactory certFactory = new HttpCertSignerFactory(); HttpCertSigner certSigner = (HttpCertSigner) certFactory.create(); certSigner.setHttpClient(httpClient); Request request = Mockito.mock(Request.class); Mockito.when(httpClient.POST("https://localhost:443/certsign/v2/x509")).thenReturn(request); ContentResponse response = Mockito.mock(ContentResponse.class); Mockito.when(request.send()).thenReturn(response); Mockito.when(response.getStatus()).thenReturn(201); Mockito.when(response.getContentAsString()).thenReturn(""); assertNull(certSigner.generateX509Certificate("csr", null, 0)); certSigner.close(); }
Example #8
Source File: HttpCertSignerTest.java From athenz with Apache License 2.0 | 6 votes |
@Test public void testGetCACertificateResponseNull() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); HttpCertSignerFactory certFactory = new HttpCertSignerFactory(); HttpCertSigner certSigner = (HttpCertSigner) certFactory.create(); certSigner.setHttpClient(httpClient); ContentResponse response = Mockito.mock(ContentResponse.class); Mockito.when(httpClient.GET("https://localhost:443/certsign/v2/x509")).thenReturn(response); Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.getContentAsString()).thenReturn(null); assertNull(certSigner.getCACertificate()); certSigner.close(); }
Example #9
Source File: CommonStarter.java From nem.deploy with MIT License | 6 votes |
private void stopOtherInstance(final URL stopURL) throws Exception { final HttpClient httpClient = new HttpClient(); try { httpClient.start(); LOGGER.info("Send shutdown to other instance..."); final ContentResponse response = httpClient.GET(stopURL.toURI()); if (response.getStatus() != HttpStatus.OK.value()) { LOGGER.info(String.format("Other instance returned %d: %s", response.getStatus(), response.getContentAsString())); } else { LOGGER.info("Pause 2 seconds"); Thread.sleep(2000); } } finally { httpClient.stop(); } }
Example #10
Source File: HttpCertSignerTest.java From athenz with Apache License 2.0 | 6 votes |
@Test public void testGenerateX509CertificateInvalidData() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); HttpCertSignerFactory certFactory = new HttpCertSignerFactory(); HttpCertSigner certSigner = (HttpCertSigner) certFactory.create(); certSigner.setHttpClient(httpClient); Request request = Mockito.mock(Request.class); Mockito.when(httpClient.POST("https://localhost:443/certsign/v2/x509")).thenReturn(request); ContentResponse response = Mockito.mock(ContentResponse.class); Mockito.when(request.send()).thenReturn(response); Mockito.when(response.getStatus()).thenReturn(201); Mockito.when(response.getContentAsString()).thenReturn("{\"pem2\": \"pem-value\"}"); assertNull(certSigner.generateX509Certificate("csr", null, 0)); Mockito.when(response.getContentAsString()).thenReturn("invalid-json"); assertNull(certSigner.generateX509Certificate("csr", null, 0)); certSigner.close(); }
Example #11
Source File: ProcessStarterTest.java From app-runner with MIT License | 6 votes |
static void startAndStop(int attempt, String appName, AppRunner runner, int port, StringBuilderWriter buildLog, StringBuilderWriter consoleLog, Matcher<String> getResponseMatcher, Matcher<String> buildLogMatcher) throws Exception { try { try (Waiter startupWaiter = Waiter.waitForApp(appName, port)) { runner.start( new OutputToWriterBridge(buildLog), new OutputToWriterBridge(consoleLog), TestConfig.testEnvVars(port, appName), startupWaiter); } try { ContentResponse resp = httpClient.GET("http://localhost:" + port + "/" + appName + "/"); assertThat(resp.getStatus(), is(200)); assertThat(resp.getContentAsString(), getResponseMatcher); assertThat(buildLog.toString(), buildLogMatcher); } finally { runner.shutdown(); } } catch (Exception e) { clearlyShowError(attempt, e, buildLog, consoleLog); } }
Example #12
Source File: CloudStoreTest.java From athenz with Apache License 2.0 | 6 votes |
@Test public void testInitializeAwsSupportInvalidDocument() throws InterruptedException, ExecutionException, TimeoutException { CloudStore store = new CloudStore(); HttpClient httpClient = Mockito.mock(HttpClient.class); ContentResponse responseDoc = Mockito.mock(ContentResponse.class); Mockito.when(responseDoc.getStatus()).thenReturn(200); Mockito.when(responseDoc.getContentAsString()).thenReturn("invalid-document"); store.setHttpClient(httpClient); Mockito.when(httpClient.GET("http://169.254.169.254/latest/dynamic/instance-identity/document")).thenReturn(responseDoc); try { store.awsEnabled = true; store.initializeAwsSupport(); fail(); } catch (ResourceException ex) { assertEquals(ex.getCode(), 500); } store.close(); }
Example #13
Source File: HttpCertSignerTest.java From athenz with Apache License 2.0 | 6 votes |
@Test public void testGetCACertificateResponseEmpty() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); HttpCertSignerFactory certFactory = new HttpCertSignerFactory(); HttpCertSigner certSigner = (HttpCertSigner) certFactory.create(); certSigner.setHttpClient(httpClient); ContentResponse response = Mockito.mock(ContentResponse.class); Mockito.when(httpClient.GET("https://localhost:443/certsign/v2/x509")).thenReturn(response); Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.getContentAsString()).thenReturn(""); assertNull(certSigner.getCACertificate()); certSigner.close(); }
Example #14
Source File: HttpServerTest.java From vespa with Apache License 2.0 | 6 votes |
private ContentResponse sendJettyClientRequest(TestDriver testDriver, HttpClient client, Object tag) throws InterruptedException, TimeoutException { int maxAttempts = 3; for (int attempt = 0; attempt < maxAttempts; attempt++) { try { ContentResponse response = client.newRequest(URI.create("https://localhost:" + testDriver.server().getListenPort() + "/")) .tag(tag) .send(); assertEquals(200, response.getStatus()); return response; } catch (ExecutionException e) { // Retry when the server closes the connection before the TLS handshake is completed. This have been observed in CI. // We have been unable to reproduce this locally. The cause is therefor currently unknown. log.log(Level.WARNING, String.format("Attempt %d failed: %s", attempt, e.getMessage()), e); Thread.sleep(10); } } throw new AssertionError("Failed to send request, see log for details"); }
Example #15
Source File: CloudStore.java From athenz with Apache License 2.0 | 6 votes |
String getMetaData(String path) { final String baseUri = "http://169.254.169.254/latest"; ContentResponse response; try { response = httpClient.GET(baseUri + path); } catch (InterruptedException | ExecutionException | TimeoutException ex) { LOGGER.error("CloudStore: unable to fetch requested uri '{}':{}", path, ex.getMessage()); return null; } if (response.getStatus() != 200) { LOGGER.error("CloudStore: unable to fetch requested uri '{}' status:{}", path, response.getStatus()); return null; } String data = response.getContentAsString(); if (data == null || data.isEmpty()) { LOGGER.error("CloudStore: received empty response from uri '{}' status:{}", path, response.getStatus()); return null; } return data; }
Example #16
Source File: CloudStoreTest.java From athenz with Apache License 2.0 | 6 votes |
@Test public void testLoadBootMetaDataInvalidIamInfoGet() throws InterruptedException, ExecutionException, TimeoutException { CloudStore store = new CloudStore(); HttpClient httpClient = Mockito.mock(HttpClient.class); ContentResponse responseDoc = Mockito.mock(ContentResponse.class); Mockito.when(responseDoc.getStatus()).thenReturn(200); Mockito.when(responseDoc.getContentAsString()).thenReturn(AWS_INSTANCE_DOCUMENT); ContentResponse responseSig = Mockito.mock(ContentResponse.class); Mockito.when(responseSig.getStatus()).thenReturn(200); Mockito.when(responseSig.getContentAsString()).thenReturn("pkcs7-signature"); ContentResponse responseInfo = Mockito.mock(ContentResponse.class); Mockito.when(responseInfo.getStatus()).thenReturn(404); store.setHttpClient(httpClient); Mockito.when(httpClient.GET("http://169.254.169.254/latest/dynamic/instance-identity/document")).thenReturn(responseDoc); Mockito.when(httpClient.GET("http://169.254.169.254/latest/dynamic/instance-identity/pkcs7")).thenReturn(responseSig); Mockito.when(httpClient.GET("http://169.254.169.254/latest/meta-data/iam/info")).thenReturn(responseInfo); assertFalse(store.loadBootMetaData()); store.close(); }
Example #17
Source File: HttpCertSignerTest.java From athenz with Apache License 2.0 | 6 votes |
@Test public void testGenerateX509CertificateResponseNull() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); HttpCertSignerFactory certFactory = new HttpCertSignerFactory(); HttpCertSigner certSigner = (HttpCertSigner) certFactory.create(); certSigner.setHttpClient(httpClient); Request request = Mockito.mock(Request.class); Mockito.when(httpClient.POST("https://localhost:443/certsign/v2/x509")).thenReturn(request); ContentResponse response = Mockito.mock(ContentResponse.class); Mockito.when(request.send()).thenReturn(response); Mockito.when(response.getStatus()).thenReturn(201); Mockito.when(response.getContentAsString()).thenReturn(null); assertNull(certSigner.generateX509Certificate("csr", null, 0)); certSigner.close(); }
Example #18
Source File: HttpCertSigner.java From athenz with Apache License 2.0 | 5 votes |
@Override public String getCACertificate() { ContentResponse response; try { response = httpClient.GET(x509CertUri); } catch (InterruptedException | ExecutionException | TimeoutException e) { LOGGER.error("getCACertificate: unable to fetch requested uri '" + x509CertUri + "': " + e.getMessage()); return null; } if (response.getStatus() != HttpStatus.OK_200) { LOGGER.error("getCACertificate: unable to fetch requested uri '" + x509CertUri + "' status: " + response.getStatus()); return null; } String data = response.getContentAsString(); if (data == null || data.isEmpty()) { LOGGER.error("getCACertificate: received empty response from uri '" + x509CertUri + "' status: " + response.getStatus()); return null; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("getCACertificate: CA Certificate" + data); } X509CertSignObject pemCert = JSON.fromString(data, X509CertSignObject.class); return (pemCert != null) ? pemCert.getPem() : null; }
Example #19
Source File: JettyReactiveHttpClientService.java From mutual-tls-ssl with Apache License 2.0 | 5 votes |
@Override public ClientResponse executeRequest(String url) throws Exception { httpClient.start(); ContentResponse contentResponse = httpClient.newRequest(url) .method(HttpMethod.GET) .header(HEADER_KEY_CLIENT_TYPE, getClientType().getValue()) .send(); httpClient.stop(); return new ClientResponse(contentResponse.getContentAsString(), contentResponse.getStatus()); }
Example #20
Source File: AudioServletTest.java From openhab-core with Eclipse Public License 2.0 | 5 votes |
@Test public void audioServletProcessesByteArrayStream() throws Exception { AudioStream audioStream = getByteArrayAudioStream(testByteArray, AudioFormat.CONTAINER_NONE, AudioFormat.CODEC_MP3); ContentResponse response = getHttpResponse(audioStream); assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.OK_200)); assertThat("The response content was not as expected", response.getContent(), is(testByteArray)); assertThat("The response media type was not as expected", response.getMediaType(), is(equalTo(MEDIA_TYPE_AUDIO_MPEG))); }
Example #21
Source File: CloudStoreTest.java From athenz with Apache License 2.0 | 5 votes |
@Test public void testLoadBootMetaData() throws InterruptedException, ExecutionException, TimeoutException { CloudStore store = new CloudStore(); HttpClient httpClient = Mockito.mock(HttpClient.class); ContentResponse responseDoc = Mockito.mock(ContentResponse.class); Mockito.when(responseDoc.getStatus()).thenReturn(200); Mockito.when(responseDoc.getContentAsString()).thenReturn(AWS_INSTANCE_DOCUMENT); ContentResponse responseSig = Mockito.mock(ContentResponse.class); Mockito.when(responseSig.getStatus()).thenReturn(200); Mockito.when(responseSig.getContentAsString()).thenReturn("pkcs7-signature"); ContentResponse responseInfo = Mockito.mock(ContentResponse.class); Mockito.when(responseInfo.getStatus()).thenReturn(200); Mockito.when(responseInfo.getContentAsString()).thenReturn(AWS_IAM_ROLE_INFO); store.setHttpClient(httpClient); Mockito.when(httpClient.GET("http://169.254.169.254/latest/dynamic/instance-identity/document")).thenReturn(responseDoc); Mockito.when(httpClient.GET("http://169.254.169.254/latest/dynamic/instance-identity/pkcs7")).thenReturn(responseSig); Mockito.when(httpClient.GET("http://169.254.169.254/latest/meta-data/iam/info")).thenReturn(responseInfo); assertTrue(store.loadBootMetaData()); assertEquals(store.awsRole, "athenz.zts"); assertEquals(store.awsRegion, "us-west-2"); store.close(); }
Example #22
Source File: DataTest.java From app-runner with MIT License | 5 votes |
private static List<String> getFilesInZip(ContentResponse resp) throws IOException { byte[] content = resp.getContent(); List<String> pathsInZip = new ArrayList<>(); try (ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(content))) { ZipEntry nextEntry; while ((nextEntry = zis.getNextEntry()) != null) { pathsInZip.add(nextEntry.getName()); } } return pathsInZip; }
Example #23
Source File: CcuGateway.java From smarthome with Eclipse Public License 2.0 | 5 votes |
/** * Main method for sending a TclRega script and parsing the XML result. */ @SuppressWarnings("unchecked") private synchronized <T> T sendScript(String script, Class<T> clazz) throws IOException { try { script = StringUtils.trim(script); if (StringUtils.isEmpty(script)) { throw new RuntimeException("Homematic TclRegaScript is empty!"); } if (logger.isTraceEnabled()) { logger.trace("TclRegaScript: {}", script); } StringContentProvider content = new StringContentProvider(script, config.getEncoding()); ContentResponse response = httpClient.POST(config.getTclRegaUrl()).content(content) .timeout(config.getTimeout(), TimeUnit.SECONDS) .header(HttpHeader.CONTENT_TYPE, "text/plain;charset=" + config.getEncoding()).send(); String result = new String(response.getContent(), config.getEncoding()); result = StringUtils.substringBeforeLast(result, "<xml><exec>"); if (logger.isTraceEnabled()) { logger.trace("Result TclRegaScript: {}", result); } return (T) xStream.fromXML(result); } catch (Exception ex) { throw new IOException(ex.getMessage(), ex); } }
Example #24
Source File: CloudStoreTest.java From athenz with Apache License 2.0 | 5 votes |
@Test public void testGetMetaDataValidResponse() throws InterruptedException, ExecutionException, TimeoutException { CloudStore store = new CloudStore(); HttpClient httpClient = Mockito.mock(HttpClient.class); ContentResponse response = Mockito.mock(ContentResponse.class); Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.getContentAsString()).thenReturn("json-document"); store.setHttpClient(httpClient); Mockito.when(httpClient.GET("http://169.254.169.254/latest/iam-info")).thenReturn(response); assertEquals(store.getMetaData("/iam-info"), "json-document"); store.close(); }
Example #25
Source File: HttpClientWrapper.java From ja-micro with Apache License 2.0 | 5 votes |
private boolean responseWasSuccessful(RpcCallExceptionDecoder decoder, ContentResponse response, int lastStatusCode) throws RpcCallException { if (shouldExposeErrorsToHttp(serviceProps)) { return lastStatusCode == 200 && response != null && response.getContent().length > 0; } else if (lastStatusCode != 0 && lastStatusCode != 200) { return false; } else if (response == null || response.getContent() == null) { return false; } RpcCallException exception = decoder.decodeException(response); return (exception == null); }
Example #26
Source File: DataTest.java From app-runner with MIT License | 5 votes |
@Test public void whenTheAppIsDeletedTheFilesAreDeletedToo() throws Exception { ContentResponse uploadResp = restClient.postData(appId, mavenZip); assertThat(uploadResp.getStatus(), is(204)); ContentResponse resp = restClient.deleteApp(appId); assertThat(resp.getStatus(), is(200)); File appDataDir = new File(dataDir, "apps/" + appId); assertThat(appDataDir.exists(), is(false)); }
Example #27
Source File: UnixLocalDownloadServiceFetcher.java From Singularity with Apache License 2.0 | 5 votes |
public ContentResponse getResponse() throws InterruptedException { try { return future.get(); } catch (ExecutionException e) { throw new RuntimeException(e); } }
Example #28
Source File: DataTest.java From app-runner with MIT License | 5 votes |
@Test public void filesInTheAppsDataDirCanBeUploadedAndDownloadedAsAZip() throws Exception { ContentResponse uploadResp = restClient.postData(appId, mavenZip); assertThat(uploadResp.getStatus(), is(204)); ContentResponse resp = restClient.getData(appId); assertThat(resp.getStatus(), is(200)); assertThat(resp.getHeaders().get("Content-Type"), CoreMatchers.equalTo("application/zip")); List<String> pathsInZip = getFilesInZip(resp); assertThat(pathsInZip, not(hasItem("instances/"))); assertThat(pathsInZip, hasItem("pom.xml")); assertThat(pathsInZip, hasItem("src/main/java/samples/App.java")); }
Example #29
Source File: HealthCheckManager.java From ja-micro with Apache License 2.0 | 5 votes |
public void updateHealthStatus(HealthCheck.Status status) throws Exception { logger.trace("Updating health of {}", serviceProps.getServiceName()); ContentResponse httpResponse = httpClient.newRequest(getHealthCheckUri(status)).method(HttpMethod.PUT).send(); if (httpResponse.getStatus() != 200) { logger.warn("Received {} trying to update health", httpResponse.getStatus()); } }
Example #30
Source File: WebServerTest.java From app-runner with MIT License | 5 votes |
@Test public void aRequestToTheRootResultsInARedirect() throws Exception { proxyMap.add("test-app", appServer.url); ContentResponse resp = client.GET(webServerUrl + "/"); assertThat(resp.getStatus(), is(302)); String location = resp.getHeaders().get("Location"); assertThat(location, is(webServerUrl + "/test-app")); resp = client.GET(location); location = resp.getHeaders().get("Location"); assertThat(resp.getStatus(), is(302)); assertThat(location, is(webServerUrl + "/test-app/")); }