()
| 235 | } |
| 236 | |
| 237 | public void start() { |
| 238 | lock(); |
| 239 | try { |
| 240 | // always try cancel reconnect task |
| 241 | if (reconnectTask != null) { |
| 242 | reconnectTask.cancel(false); |
| 243 | reconnectTask = null; |
| 244 | } |
| 245 | if (socket == null) { |
| 246 | if (null == url || url.isBlank()) |
| 247 | socket = service.newClientSocket(hostNameOrAddress, port, userState, this); |
| 248 | else |
| 249 | socket = service.newWebsocketClient(url, userState, this); |
| 250 | } |
| 251 | } finally { |
| 252 | unlock(); |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | public void stop() { |
| 257 | stop(null); |
no test coverage detected