logger.info("Starting BitTorrent tracker on {}...", getAnnounceUrl()); connection = new SocketConnection(new ContainerServer(myTrackerServiceContainer));
final SimpleTraceAnalyzer analyzer = new SimpleTraceAnalyzer(); final SocketProcessor server = serverProvider.get(); connection = new SocketConnection(server, analyzer);
@BeforeClass public static void startServer() throws IOException { socketConnection = new SocketConnection(new Container() { public void handle(Request req, Response resp) { try {
eg : SocketConnection connection = new SocketConnection(); String token = "message that you want to write on server"; String response = connecation.EstablishConnection(token);
private class ActivationTask extends AsyncTask<String, String, String> { @Override protected String doInBackground(String... params) { SocketConnection connection = new SocketConnection(); String token = "getActivation|" + params[0] + "|"; return connection.EstablishConnection(token); } @Override protected void onPreExecute() { super.onPreExecute(); progressDialog.show(); } @Override protected void onPostExecute(String s) { super.onPostExecute(s); progressDialog.dismiss(); if (s != null) { Log.e("RESULT" , s); } } }
/** * Starts the server. * * @return Port used by server. * @throws IOException In case starting fails. */ public int start() throws IOException { handler = new ExpectationHandler(); connection = new SocketConnection(handler); final SocketAddress address = new InetSocketAddress(port); final InetSocketAddress connectedAddress = (InetSocketAddress) connection.connect(address); connectedPort = connectedAddress.getPort(); return connectedPort; }
public Adapter(Analyser handler, Scenario scenario) throws Exception { this.requestIds = Collections.synchronizedSet(new HashSet<String>()); this.server = new ContainerSocketProcessor(this, 10); this.connection = new SocketConnection(server); this.manager = new SecurityManager(); this.requests = new AtomicInteger(); this.failures = new AtomicInteger(); this.debug = scenario.debug(); this.handler = handler; this.scenario = scenario; }
public void start() { stopped = false; try { connection = new SocketConnection(this); } catch (Exception ex) { throw new RuntimeException("Couldnt create socket connection", ex); } initHttp(connection, httpPort); thMonitor = new Thread(new TaskMonitor()); thMonitor.start(); }
/** * Starts the server * @param port port of the server * @throws Exception */ public void start(int port) throws Exception { ServerLyzer.port = port; Container container = new ServerLyzer(config); Server server = new ContainerServer(container); this.connection = new SocketConnection(server); SocketAddress address = new InetSocketAddress(port); System.out.println("Starting server on port "+port); this.connection.connect(address); }
public void start(InetSocketAddress bindAddress, int poolSize) throws Exception { executor = Executors.newFixedThreadPool(poolSize); container = new HttpServer(); server = new ContainerServer(container); connection = new SocketConnection(server); SocketAddress address = bindAddress; connection.connect(address); }
/** * Starts proxy. * * @throws IOException In case starting fails. */ public void start() throws IOException { // Close existing connection if it exists. if (connection != null) { connection.close(); } proxy = new ProxyImplementation(); connection = new SocketConnection(proxy); final SocketAddress address = new InetSocketAddress(port); connection.connect(address); LOGGER.debug("Started on port: " + port); }
@Override protected void _start() throws Exception { logger.debug("starting web server"); router = setupRouter(); Container container = new Container() { @Override public void handle(Request request, Response response) { try { if (request.getTarget().startsWith(routerPath)) { router.route( new SimpleRestxRequest(httpSettings, routerPath, request), new SimpleRestxResponse(response)); } else { response.getPrintStream().print("Not found..."); response.getPrintStream().close(); } } catch (IOException e) { throw new RuntimeException(e); } } }; Server server = new ContainerServer(container); connection = new SocketConnection(server); SocketAddress address = new InetSocketAddress(port); connection.connect(address); }
@Override protected void _start() throws Exception { logger.debug("starting web server"); router = setupRouter(); Container container = new Container() { @Override public void handle(Request request, Response response) { try { if (request.getTarget().startsWith(routerPath)) { router.route( new SimpleRestxRequest(httpSettings, routerPath, request), new SimpleRestxResponse(response)); } else { response.getPrintStream().print("Not found..."); response.getPrintStream().close(); } } catch (IOException e) { throw new RuntimeException(e); } } }; Server server = new ContainerServer(container); connection = new SocketConnection(server); SocketAddress address = new InetSocketAddress(port); connection.connect(address); }
@Override public int start(int port, SSLContext context, boolean authReq) throws IOException { DirectRouter router = new DirectRouter(this); RouterContainer routerContainer = new RouterContainer(this, router, webSocketThreads); ContainerSocketProcessor processor = new ContainerSocketProcessor(routerContainer, threadCount, selectThreads); socketConnection = new SocketConnection(authReq ? new AuthRequiredServer(processor) : processor); InetSocketAddress actualAddress = (InetSocketAddress) socketConnection.connect(new InetSocketAddress(port), context); return actualAddress.getPort(); }
public void start() throws IOException { server = new FixdServer(new ContainerServer(container)); connection = new SocketConnection(server, new LoggingAgent()); SocketAddress address = new InetSocketAddress(port); actualConnectionAddress = (InetSocketAddress)connection.connect(address); }
private String startMockServer(Container container) throws IOException { ContainerServer server = new ContainerServer(container); connection = new SocketConnection(server); InetSocketAddress address = (InetSocketAddress) connection .connect(new InetSocketAddress(0)); int port = address.getPort(); return "http://localhost:" + port + "/"; }
public RedirectServer(int port) throws Exception { this.port = port; Allocator allocator = new FileAllocator(); TransportProcessor processor = new ContainerTransportProcessor(this, allocator, 5); SocketProcessor server = new TransportSocketProcessor(processor); this.connection = new SocketConnection(server); this.address = new InetSocketAddress(port); }
public BasicAuthServer(int port) throws Exception { this.port = port; Allocator allocator = new FileAllocator(); TransportProcessor processor = new ContainerTransportProcessor(this, allocator, 5); SocketProcessor server = new TransportSocketProcessor(processor); this.connection = new SocketConnection(server); this.address = new InetSocketAddress("localhost", port); }
public HttpHeaderServer(int port) throws Exception { Allocator allocator = new FileAllocator(); TransportProcessor processor = new ContainerTransportProcessor(this, allocator, 5); SocketProcessor server = new TransportSocketProcessor(processor); this.connection = new SocketConnection(server); this.address = new InetSocketAddress(port); }
/** * Opens the HTTP server * @throws IOException */ public void start() throws IOException { stop(); this.server = new ContainerServer(this); this.connection = new SocketConnection(server); SocketAddress address = new InetSocketAddress(this.port); this.connection.connect(address); }