use of io.undertow.testutils.ProxyIgnore in project undertow by undertow-io.
the class SimpleConfidentialRedirectTestCase method testRedirectWithFullURLInPath.
@ProxyIgnore
public void testRedirectWithFullURLInPath() throws IOException {
DefaultServer.isProxy();
//see UNDERTOW-874
try (Socket socket = new Socket(DefaultServer.getHostAddress(), DefaultServer.getHostPort())) {
socket.getOutputStream().write(("GET " + DefaultServer.getDefaultServerURL() + "/foo HTTP/1.0\r\n\r\n").getBytes(StandardCharsets.UTF_8));
String result = FileUtils.readFile(socket.getInputStream());
Assert.assertTrue(result.contains("Location: " + DefaultServer.getDefaultServerSSLAddress() + "/foo"));
}
}
use of io.undertow.testutils.ProxyIgnore in project undertow by undertow-io.
the class WebSocketClient13TestCase method testMessageViaWssProxy.
@Test
@ProxyIgnore
public void testMessageViaWssProxy() throws Exception {
final WebSocketChannel webSocketChannel = WebSocketClient.connectionBuilder(worker, DefaultServer.getBufferPool(), new URI(DefaultServer.getDefaultServerSSLAddress())).setSsl(new UndertowXnioSsl(Xnio.getInstance(), OptionMap.EMPTY, DefaultServer.getClientSSLContext())).setProxyUri(new URI("http", null, DefaultServer.getHostAddress("default"), DefaultServer.getHostPort("default") + 10, "/proxy", null, null)).connect().get();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<String> result = new AtomicReference<>();
webSocketChannel.getReceiveSetter().set(new AbstractReceiveListener() {
@Override
protected void onFullTextMessage(WebSocketChannel channel, BufferedTextMessage message) throws IOException {
String data = message.getData();
result.set(data);
latch.countDown();
}
@Override
protected void onError(WebSocketChannel channel, Throwable error) {
super.onError(channel, error);
error.printStackTrace();
latch.countDown();
}
});
webSocketChannel.resumeReceives();
StreamSinkFrameChannel sendChannel = webSocketChannel.send(WebSocketFrameType.TEXT);
new StringWriteChannelListener("Hello World").setup(sendChannel);
latch.await(10, TimeUnit.SECONDS);
Assert.assertEquals("Hello World", result.get());
webSocketChannel.sendClose();
Assert.assertEquals("CONNECT " + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostSSLPort("default"), connectLog.poll());
}
use of io.undertow.testutils.ProxyIgnore in project undertow by undertow-io.
the class QueryParametersTestCase method testQueryParametersShiftJIS.
@Test
@ProxyIgnore
public void testQueryParametersShiftJIS() throws IOException {
OptionMap old = DefaultServer.getUndertowOptions();
try {
DefaultServer.setUndertowOptions(OptionMap.create(UndertowOptions.URL_CHARSET, "Shift_JIS"));
TestHttpClient client = new TestHttpClient();
try {
runTest(client, "{unicode=>ใในใ}", "/path?unicode=%83e%83X%83g");
} finally {
client.getConnectionManager().shutdown();
}
} finally {
DefaultServer.setUndertowOptions(old);
}
}
use of io.undertow.testutils.ProxyIgnore in project undertow by undertow-io.
the class WebSocketClient13TestCase method testMessageViaProxy.
@Test
@ProxyIgnore
public void testMessageViaProxy() throws Exception {
final WebSocketChannel webSocketChannel = WebSocketClient.connectionBuilder(worker, DefaultServer.getBufferPool(), new URI(DefaultServer.getDefaultServerURL())).setProxyUri(new URI("http", null, DefaultServer.getHostAddress("default"), DefaultServer.getHostPort("default") + 10, "/proxy", null, null)).connect().get();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<String> result = new AtomicReference<>();
webSocketChannel.getReceiveSetter().set(new AbstractReceiveListener() {
@Override
protected void onFullTextMessage(WebSocketChannel channel, BufferedTextMessage message) throws IOException {
String data = message.getData();
result.set(data);
latch.countDown();
}
@Override
protected void onError(WebSocketChannel channel, Throwable error) {
super.onError(channel, error);
error.printStackTrace();
latch.countDown();
}
});
webSocketChannel.resumeReceives();
StreamSinkFrameChannel sendChannel = webSocketChannel.send(WebSocketFrameType.TEXT);
new StringWriteChannelListener("Hello World").setup(sendChannel);
latch.await(10, TimeUnit.SECONDS);
Assert.assertEquals("Hello World", result.get());
webSocketChannel.sendClose();
Assert.assertEquals("CONNECT " + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default"), connectLog.poll());
}
Aggregations