@Override public void setUp() throws Exception { super.setUp(); SessionManager sessionManager = Mockito.mock(SessionManager.class); /* * NOTE: Specifying port zero (0) causes the OS to select a random port. * This allows the test to run without clashing with any potentially in-use port. */ server = new ServerRpcProvider(new InetSocketAddress[] {new InetSocketAddress("localhost", 0)}, new String[] {"./war"}, sessionManager, null, null, false, null, null, MoreExecutors.sameThreadExecutor()); final Map<String, Object> props = new HashMap<>(); props.put("network.websocket_max_idle_time", 0); props.put("network.websocket_max_message_size", 2); Injector injector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { bind(ServerRpcProvider.class).toInstance(server); bind(Config.class).toInstance(ConfigFactory.parseMap(props)); } }); server.startWebSocketServer(injector); }
@Override public void setUp() throws Exception { super.setUp(); SessionManager sessionManager = Mockito.mock(SessionManager.class); org.eclipse.jetty.server.SessionManager jettySessionManager = Mockito.mock(org.eclipse.jetty.server.SessionManager.class); /* * NOTE: Specifying port zero (0) causes the OS to select a random port. * This allows the test to run without clashing with any potentially in-use port. */ server = new ServerRpcProvider(new InetSocketAddress[] {new InetSocketAddress("localhost", 0)}, new String[] {"./war"}, sessionManager, null, null, false, null, null, MoreExecutors.sameThreadExecutor(), 0, 2, 60, 3600, 3600, "localhost"); final Map<String, Object> props = new HashMap<>(); props.put("network.websocket_max_idle_time", 0); props.put("network.websocket_max_message_size", 2); Injector injector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { bind(ServerRpcProvider.class).toInstance(server); bind(Config.class).toInstance(ConfigFactory.parseMap(props)); bind(SessionManager.class).toInstance(sessionManager); bind(NamingStore.class).toInstance(Mockito.mock(NamingStore.class)); bind(WaveletProvider.class).toInstance(Mockito.mock(WaveletProvider.class)); } }); server.startWebSocketServer(injector); }