public synchronized InternalConnection getConnection( final String apiKey, final PusherOptions options) { if (connection == null) { try { connection = new WebSocketConnection( options.buildUrl(apiKey), options.getActivityTimeout(), options.getPongTimeout(), options.getProxy(), this); } catch (final URISyntaxException e) { throw new IllegalArgumentException("Failed to initialise connection", e); } } return connection; }