org.eclipse.jetty.websocket.WebSocketClientFactory Java Examples
The following examples show how to use
org.eclipse.jetty.websocket.WebSocketClientFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSocket.java From IoTgo_Android_App with MIT License | 5 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); _factory = new WebSocketClientFactory(); _conn = new SparseArray<Connection>(); _create = new ConnectionTask(_factory, _conn); _send = new SendingTask(_conn); _close = new DisconnectionTask(_conn); try { start(); } catch (Exception e) { } }
Example #2
Source File: WebSocket.java From IoTgo_Android_App with MIT License | 5 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); _factory = new WebSocketClientFactory(); _conn = new SparseArray<Connection>(); _create = new ConnectionTask(_factory, _conn); _send = new SendingTask(_conn); _close = new DisconnectionTask(_conn); try { start(); } catch (Exception e) { } }
Example #3
Source File: WebSocketServerInputOperatorTest.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
@Test public void simpleTest() throws Exception { final int port = 6666; String connectionURI = "ws://localhost:" + port + WebSocketServerInputOperator.DEFAULT_EXTENSION; final String message = "hello world"; WebSocketServerInputOperator wssio = new TestWSSIO(); wssio.setPort(port); wssio.setup(null); WebSocketClientFactory clientFactory = new WebSocketClientFactory(); clientFactory.start(); WebSocketClient client = new WebSocketClient(clientFactory); Future<WebSocket.Connection> connectionFuture = client.open(new URI(connectionURI), new TestWebSocket()); WebSocket.Connection connection = connectionFuture.get(5, TimeUnit.SECONDS); connection.sendMessage(message); long startTime = System.currentTimeMillis(); while (startTime + 10000 > System.currentTimeMillis()) { if (TestWSSIO.messages.size() >= 1) { break; } Thread.sleep(100); } Assert.assertEquals("The number of messages recieved is incorrect.", 1, TestWSSIO.messages.size()); Assert.assertEquals("Incorrect message received", message, TestWSSIO.messages.get(0)); connection.close(); wssio.teardown(); }
Example #4
Source File: WebSocket.java From WebSocket-for-Android with Apache License 2.0 | 5 votes |
@Override public void initialize(CordovaInterface cordova, final CordovaWebView webView) { super.initialize(cordova, webView); _factory = new WebSocketClientFactory(); _conn = new SparseArray<Connection>(); _executor = Executors.newSingleThreadExecutor(); _runner = new TaskRunner(); _runner.setTask(CREATE_TASK, new ConnectionTask(_factory, _conn)); _runner.setTask(SEND_TASK, new SendingTask(_conn)); _runner.setTask(CLOSE_TASK, new DisconnectionTask(_conn)); _runner.setTask(RESET_TASK, new ResetTask(_conn)); _runner.setTask(DESTROY_TASK, new DestroyTask(_factory, _conn)); _executor.execute(_runner); Log.setLogLevel(getLogLevel(this.preferences)); }
Example #5
Source File: ConnectionTask.java From WebSocket-for-Android with Apache License 2.0 | 5 votes |
/** * Constructor * * @param factory * @param map */ public ConnectionTask(WebSocketClientFactory factory, SparseArray<Connection> map) { _factory = factory; _map = map; if (!_factory.isRunning()) { try { _factory.start(); } catch (Exception e) { } } }
Example #6
Source File: WampJettyFactory.java From WalletCordova with GNU Lesser General Public License v2.1 | 4 votes |
public WebSocketClientFactory getJettyFactory() { return fact; }
Example #7
Source File: WampJettyFactory.java From WalletCordova with GNU Lesser General Public License v2.1 | 4 votes |
public void setJettyFactory(WebSocketClientFactory fact) { this.fact = fact; }
Example #8
Source File: ConnectionTask.java From IoTgo_Android_App with MIT License | 2 votes |
/** * Constructor * * @param factory * @param map */ public ConnectionTask(WebSocketClientFactory factory, SparseArray<Connection> map) { _factory = factory; _map = map; }
Example #9
Source File: ConnectionTask.java From IoTgo_Android_App with MIT License | 2 votes |
/** * Constructor * * @param factory * @param map */ public ConnectionTask(WebSocketClientFactory factory, SparseArray<Connection> map) { _factory = factory; _map = map; }
Example #10
Source File: DestroyTask.java From WebSocket-for-Android with Apache License 2.0 | 2 votes |
/** * Constructor * * @param factory * @param map */ public DestroyTask(WebSocketClientFactory factory, SparseArray<Connection> map) { _factory = factory; _map = map; }