use of org.mortbay.jetty.bio.SocketConnector in project hudson-2.x by hudson.
the class HudsonTestCase method createWebServer.
/**
* Prepares a webapp hosting environment to get {@link ServletContext} implementation
* that we need for testing.
*/
protected ServletContext createWebServer() throws Exception {
server = new Server();
WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath);
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[] { new WebXmlConfiguration(), new NoListenerConfiguration() });
server.setHandler(context);
context.setMimeTypes(MIME_TYPES);
SocketConnector connector = new SocketConnector();
server.addConnector(connector);
server.addUserRealm(configureUserRealm());
server.start();
localPort = connector.getLocalPort();
return context.getServletContext();
}
use of org.mortbay.jetty.bio.SocketConnector in project commons by twitter.
the class UrlResolverUtilTest method startServer.
private String startServer() throws Exception {
final Server server = new Server();
final SocketConnector connector = new SocketConnector();
connector.setHost("127.0.0.1");
connector.setPort(0);
server.addConnector(connector);
Context context = new Context(server, "/", Context.NO_SECURITY);
context.addServlet(new ServletHolder(servlet), "/*");
server.start();
addTearDown(new TearDown() {
@Override
public void tearDown() throws Exception {
server.stop();
}
});
return "http://" + connector.getHost() + ":" + connector.getLocalPort() + "/";
}
use of org.mortbay.jetty.bio.SocketConnector in project nhin-d by DirectProject.
the class ConfigServiceRunner method startConfigService.
public static synchronized void startConfigService() throws Exception {
if (server == null) {
/*
* Setup the configuration service server
*/
server = new Server();
SocketConnector connector = new SocketConnector();
HTTPPort = AvailablePortFinder.getNextAvailable(8081);
connector.setPort(HTTPPort);
// certificate service
WebAppContext context = new WebAppContext("src/main/webapp", "/config-service");
server.setSendServerVersion(false);
server.addConnector(connector);
server.addHandler(context);
server.start();
serviceURL = "http://localhost:" + HTTPPort + "/";
}
}
use of org.mortbay.jetty.bio.SocketConnector in project nhin-d by DirectProject.
the class TxsServiceRunner method startTxsService.
public static synchronized void startTxsService() throws Exception {
if (server == null) {
/*
* Setup the configuration service server
*/
server = new Server();
SocketConnector connector = new SocketConnector();
HTTPPort = AvailablePortFinder.getNextAvailable(1024);
connector.setPort(HTTPPort);
WebAppContext context = new WebAppContext("src/test/resources/webapp", "/");
server.setSendServerVersion(false);
server.addConnector(connector);
server.addHandler(context);
server.start();
txsServiceURL = "http://localhost:" + HTTPPort + "/";
}
}
use of org.mortbay.jetty.bio.SocketConnector in project nhin-d by DirectProject.
the class ConfigServiceRunner method startConfigService.
public static synchronized void startConfigService() throws Exception {
if (server == null) {
/*
* Setup the configuration service server
*/
server = new Server();
SocketConnector connector = new SocketConnector();
HTTPPort = AvailablePortFinder.getNextAvailable(1024);
connector.setPort(HTTPPort);
WebAppContext context = new WebAppContext("src/test/resources/webapp", "/");
server.setSendServerVersion(false);
server.addConnector(connector);
server.addHandler(context);
server.start();
configServiceURL = "http://localhost:" + HTTPPort + "/ConfigurationService";
restAPIBaseURL = "http://localhost:" + HTTPPort + "/api";
}
}
Aggregations