private boolean canProceed() throws SSLException {
		while (true) {
			switch (mEngine.getHandshakeStatus()) {
				case NEED_TASK:
					runSSLTasks();
					break;
				case NEED_UNWRAP:
					switch (mEngine.unwrap(mInboundData, mAppData).getStatus()) {
						case BUFFER_OVERFLOW:
							resizeAppDataBuffer();
							break;
						case BUFFER_UNDERFLOW:
							return false;
						case CLOSED:
							throw new SSLException("Connection closed (unwrap)");
						default:
							break;
					}
					break;
				case NEED_WRAP:
					switch (mEngine.wrap(EMPTY_BUFFER, mOutboundData).getStatus()) {
						case BUFFER_UNDERFLOW:
							// Should not be possible
							throw new SSLException("Buffer underflow during handshake wrap");
						case CLOSED:
							throw new SSLException("Connection closed (wrap)");
						default:
							break;
					}
					sendOutboundData();
					break;
				default:
					return true;
			}
		}
	}