use of org.jboss.resteasy.plugins.server.reactor.netty.ReactorNettyJaxrsServer in project resteasy by resteasy.
the class Netty4ApplicationPathTest method testWithApplication.
@Test
public void testWithApplication() throws Exception {
ReactorNettyJaxrsServer server = null;
Client client = null;
try {
ResteasyDeployment deployment = new ResteasyDeploymentImpl();
Application app = new TestApplication();
deployment.setApplication(app);
server = new ReactorNettyJaxrsServer();
server.setDeployment(deployment);
server.setHostname("localhost");
server.setPort(8080);
server.start();
// call resource
final String path = "/rest-test/echo";
client = ClientBuilder.newClient();
String url = String.format("http://%s:%d%s", server.getHostname(), server.getPort(), path);
Response response = client.target(url).queryParam("text", ECHO).request().get();
assertEquals(HttpResponseCodes.SC_OK, response.getStatus());
String msg = response.readEntity(String.class);
assertEquals(ECHO, msg);
} finally {
if (client != null) {
client.close();
}
if (server != null) {
server.stop();
}
}
}
use of org.jboss.resteasy.plugins.server.reactor.netty.ReactorNettyJaxrsServer in project resteasy by resteasy.
the class PortAssigningTest method testZeroPort.
@Test
public void testZeroPort() throws Exception {
// given
ReactorNettyJaxrsServer server = new ReactorNettyJaxrsServer();
server.setPort(0);
server.getDeployment();
// when
server.start();
int ip = server.getPort();
server.stop();
// then
Assert.assertTrue(ip != 0);
}
use of org.jboss.resteasy.plugins.server.reactor.netty.ReactorNettyJaxrsServer in project resteasy by resteasy.
the class HeaderTooLongTest method setup.
@BeforeClass
public static void setup() throws Exception {
final ReactorNettyJaxrsServer reactorNettyJaxrsServer = new ReactorNettyJaxrsServer();
reactorNettyJaxrsServer.setDecoderSpecFn(spec -> spec.maxHeaderSize(MAX_HEADER_SIZE));
ReactorNettyContainer.start(reactorNettyJaxrsServer).getRegistry().addPerRequestResource(Resource.class);
client = ClientBuilder.newClient();
}
use of org.jboss.resteasy.plugins.server.reactor.netty.ReactorNettyJaxrsServer in project resteasy by resteasy.
the class RESTEASY1325Test method testIdleCloseConnection.
@Test(timeout = IDLE_TIMEOUT_SEC * 1000 + 1000)
public void testIdleCloseConnection() throws Exception {
ReactorNettyJaxrsServer netty = new ReactorNettyJaxrsServer();
ResteasyDeployment deployment = new ResteasyDeploymentImpl();
netty.setDeployment(deployment);
netty.setPort(TestPortProvider.getPort());
netty.setRootResourcePath("");
netty.setSecurityDomain(null);
netty.setIdleTimeout(IDLE_TIMEOUT);
netty.start();
deployment.getRegistry().addSingletonResource(new Resource());
try {
callAndIdle();
} finally {
netty.stop();
}
}
use of org.jboss.resteasy.plugins.server.reactor.netty.ReactorNettyJaxrsServer in project resteasy by resteasy.
the class ResteasyTrailingSlashTest method init.
@BeforeClass
public static void init() throws Exception {
server = new ReactorNettyJaxrsServer();
server.setPort(TestPortProvider.getPort());
server.setRootResourcePath("");
server.setSecurityDomain(null);
// rls server.getDeployment().getRegistry().addPerRequestResource(Resource.class);
// rls ResteasyDeployment deployment = server.getDeployment();
server.getDeployment().getScannedResourceClasses().add(Resource.class.getName());
server.start();
}
Aggregations