/** * {@inheritDoc} */ @Override public synchronized void connect() throws SerialException { if (!isConnected()) { try { if (client.isStopping() || client.isStopped()) { client.start(); } client.connect(this, new URI(wsUrl)); this.wait(DEFAULT_CONNECT_TIME); if (this.session == null) { client.stop(); throw new SerialException("Failed to connect to " + alias + " in " + (DEFAULT_CONNECT_TIME / 1000) + " seconds"); } // Setting the idle timeout for the client connection. client.setMaxIdleTimeout(CLIENT_MAX_IDLE_TIMEOUT); } catch (Throwable t) { throw new SerialException("Failed to establish the web socket connection.", t); } } else { logger.warn(alias + " is already connected"); } }
@Override protected void connectNativeClient() throws TimeoutException, Exception { if (jettyClient == null || jettyClient.isStopped() || jettyClient.isStopping()) {