use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class ProxyAdjacentPeerAddressHandlerTest method shouldObtainSingleValueWithoutCommas.
@Test
public void shouldObtainSingleValueWithoutCommas() throws IOException, InterruptedException {
final URL url = new URL(String.format(URL_STRING, server.host, server.port) + URL_QUERY_STRING);
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("X-Forwarded-For", "127.0.0.1");
conn.setRequestMethod("GET");
assertEquals(200, conn.getResponseCode());
final EventPayload payload = server.waitForEvent();
assertEquals("127.0.0.1", payload.event.exchange.getSourceAddress().getHostString());
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class ProxyAdjacentPeerAddressHandlerTest method shouldAllowWhitespaceAfterComma.
@Test
public void shouldAllowWhitespaceAfterComma() throws IOException, InterruptedException {
final URL url = new URL(String.format(URL_STRING, server.host, server.port) + URL_QUERY_STRING);
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("X-Forwarded-For", "127.0.0.1, 192.168.13.23");
conn.setRequestMethod("GET");
assertEquals(200, conn.getResponseCode());
final EventPayload payload = server.waitForEvent();
assertEquals("192.168.13.23", payload.event.exchange.getSourceAddress().getHostString());
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class ProxyAdjacentPeerAddressHandlerTest method shouldAllowMultipleXffHeaders.
@Test
public void shouldAllowMultipleXffHeaders() throws IOException, InterruptedException {
final URL url = new URL(String.format(URL_STRING, server.host, server.port) + URL_QUERY_STRING);
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("X-Forwarded-For", "127.0.0.1, 8.8.8.8");
conn.addRequestProperty("X-Forwarded-For", "192.168.13.23");
conn.setRequestMethod("GET");
assertEquals(200, conn.getResponseCode());
final EventPayload payload = server.waitForEvent();
assertEquals("192.168.13.23", payload.event.exchange.getSourceAddress().getHostString());
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class RequestChecksumTest method shouldFlagPartialChecksumAsCorrupted.
@Test
public void shouldFlagPartialChecksumAsCorrupted() throws IOException, InterruptedException {
for (final String urlQueryChecksumPartial : URL_QUERY_CHECKSUM_PARTIALS) {
request(urlQueryChecksumPartial);
Preconditions.checkState(null != server);
final EventPayload payload = server.waitForEvent();
assertTrue(payload.event.corruptEvent);
}
}
use of io.divolte.server.ServerTestUtils.EventPayload in project divolte-collector by divolte.
the class RequestChecksumTest method shouldChecksumCorrectlyWithNonAsciiParameters.
@Test
public void shouldChecksumCorrectlyWithNonAsciiParameters() throws IOException, InterruptedException {
request(URL_QUERY_CHECKSUM_UNICODE);
Preconditions.checkState(null != server);
final EventPayload payload = server.waitForEvent();
final DivolteEvent eventData = payload.event;
assertFalse(eventData.corruptEvent);
assertEquals(Optional.of("ụñ⚕©ºḌℨ"), eventData.eventType);
}
Aggregations