final public boolean handshakeResponse(ByteBuffer downloadBuffer) throws WebSocketException {
		ByteBuffer buffer = null;
		try{
			if (state == State.INIT || state == State.DONE) {
				transitionTo(State.METHOD);
				responseStatus = -1;
				httpResponseHeaderParser = new HttpResponseHeaderParser();
				bufferManager.init();
				buffer = downloadBuffer;
			} else {
				buffer = bufferManager.getBuffer(downloadBuffer);
			}

			if (state == State.METHOD || state == State.HEADER) {
				int position = buffer.position();
				if (!parseHandshakeResponseHeader(buffer)) {
					buffer.position(position);
					bufferManager.storeFragmentBuffer(buffer);
					return false;
				}
				transitionTo(State.BODY);
			}

			if (state == State.BODY) {
				int position = buffer.position();
				if (!parseHandshakeResponseBody(buffer)) {
					buffer.position(position);
					bufferManager.storeFragmentBuffer(buffer);
					return false;
				}
			}

			return done();
		}finally{
			if(buffer != null && buffer != downloadBuffer){
				downloadBuffer.position(downloadBuffer.limit() - buffer.remaining());
			}
		}
	}