/** * Reconnects the client if it's not already connected. * * @throws IOException * If {@link IOException} occurs during the connection. */ private void reconnectClient() throws IOException { if (!isConnected()) { client.reconnect(); bindServices(); } }
/** * Starts the client and tries to make a connection to the given host/port. * * @param host * Host IP address. * @param port * Port to connect to. * * @throws IOException * If {@link IOException} occurs during the connection. */ private void startClient(String host, int port) throws IOException { if (null != client) { client.start(); client.connect(5000, host, port); bindServices(); } }