public boolean waitForConnection() {
		if (connected) {
			log("error: connection has been already established");
			return true;
		}
		if (connecting) {
			log("error: already waiting for client");
			return true;
		}

		connecting = true;
		abortRequestSent = false;

		if (!serverSocketOpened)
			openServerSocket();

		echo.waitForProbe();

		Timer serverSocketTimer = new Timer();
		serverSocketTimer.schedule(new TimerTask() {
			@Override
			public void run() {
				if (!connected)
					disconnect(false);
			}
		}, TIMEOUT);

		try {
			accessibleSocket = serverSocket.accept();
			serverSocketTimer.cancel();
		} catch (IOException e) {
			if (abortRequestSent) {
				log("waiting for a client aborted");
			} else {
				disconnect(false);
				log("error: connection establishment unsuccessful");
				logExceptionMessage(e);
			}
			serverSocketTimer.cancel();
			return false;
		}

		if (!abortRequestSent) {
			try {
				inFromClient = new BufferedReader(new InputStreamReader(
						accessibleSocket.getInputStream()));
				outToClient = new PrintWriter(
						accessibleSocket.getOutputStream(), true);
			} catch (IOException e) {
				if (!abortRequestSent)
					disconnect(false);
				logExceptionMessage(e);
				return false;
			}

			connecting = false;
			connected = true;
			stability = STABLE;
			startPingThread();
			log("new connection established");
			return true;
		} else {
			connecting = false;
			accessibleSocket = null;
			return false;
		}
	}