private Object waitForResponse(final DataPacket question, final int timeout) throws ConnectionException {
        final long endTime;
        if (timeout > 0) {
            endTime = System.currentTimeMillis() + timeout;
        } else {
            endTime = Long.MAX_VALUE;
        }

        while (System.currentTimeMillis() < endTime) {
            if (!responses.containsKey(question)) {
                if (checkStatus().equals(Status.ONLINE)) {
                    try {
                        Object response = pushDataToOnlineClient(question, timeout);
                        if (response != dummy) {
                            unsentData.remove(question);
                            responses.put(question, response);
                        }
                    } catch (ConnectionException ex) {
                        LOG.log(Level.WARNING, "Online client connection failed - {0}", ex.getExceptionCause());
                    }

                }
            } else {
                break;
            }

            synchronized (responses) {
                try {
                    responses.wait(STATUS_CHECK_INTERVAL);
                } catch (InterruptedException ex) {
                }
            }
        }

        if (unsentData.contains(question)) {
            unsentData.remove(question);
        }

        if (responses.containsKey(question)) {
            return responses.get(question);
        } else {
            throw new ConnectionException(ConnectionExceptionCause.TIMEOUT);
        }
    }