Contacts server and tries to retrieve response payload via serialId.
<p>
Repeats the retrieval until the payload is found or number of allowed iterations is reached.
195604
private ResponsePayload retrieveResponsePayload(long serialId) throws InterruptedException {
        ResponsePayloadWasNeverRegistered last = null;
        for (int i = 0; i <= 10; i++) {
            try {
                RetrievePayloadFromServer result =
                    remoteOperationService().execute(new RetrievePayloadFromServer(serialId));
                return result.getResponsePayload();
            } catch (ResponsePayloadWasNeverRegistered e) {
                Thread.sleep(300);
                last = e;
            } catch (Throwable e) {
                throw new ServerWarpExecutionException("failed to retrieve a response payloade: " + e.getMessage(), e);
            }
        }
        throw last;
    }
110925
@Override
    public T handleResponse(final HttpResponse response) throws IOException {

        InputStream content = null;
        final T addresses;

        try {
            final StatusLine status = response.getStatusLine();
            if (status.getStatusCode() >= HttpStatus.SC_BAD_REQUEST) {
                throw new IOException(String.format("HTTP error: %s %s", status.getStatusCode(), status.getReasonPhrase()));
            }
            content = response.getEntity().getContent();
            addresses = gsonInstance
                    .fromJson(new InputStreamReader(content, "utf-8"), responseType);
        } finally {
            if (null != content) {
                content.close();
            }
            response.getEntity().consumeContent();
        }

        return addresses;
    }
177225
def _handle_response(self, msg_id, result=None, error=None):
        """"""
        request_future = self._server_request_futures.pop(msg_id, None)

        if not request_future:
            log.warn("Received response to unknown message id %s", msg_id)
            return

        if error is not None:
            log.debug("Received error response to message %s: %s", msg_id, error)
            request_future.set_exception(JsonRpcException.from_dict(error))

        log.debug("Received result for message %s: %s", msg_id, result)
        request_future.set_result(result)
131004
private Object readResponse(Type returnType, JsonNode jsonNode, String id) throws Throwable {
		raiseExceptionIfNotValidResponseObject(jsonNode);
		final ObjectNode jsonObject = ObjectNode.class.cast(jsonNode);
		notifyAnswerListener(jsonObject);
		handleErrorResponse(jsonObject);
		if (hasResult(jsonObject)) {
			if (isReturnTypeInvalid(returnType)) {
				return null;
			}
			return constructResponseObject(returnType, jsonObject);
		}
		return null;
	}
425481
private void processReturnOperations(final ResponseMessage response) {
    final List<OperationMessage> ops = response.getOperations();

    // If there are no observable effects, this will be null
    if (ops == null) {
      return;
    }

    for (final OperationMessage op : ops) {
      final SimpleProxyId<?> id = this.getId(op);
      WriteOperation[] toPropagate = null;

      // May be null if the server is returning an unpersisted object
      final WriteOperation effect = op.getOperation();
      if (effect != null) {
        switch (effect) {
          case DELETE:
            toPropagate = DELETE_ONLY;
            break;
          case PERSIST:
            toPropagate = PERSIST_AND_UPDATE;
            break;
          case UPDATE:
            toPropagate = UPDATE_ONLY;
            break;
          default:
            // Should never reach here
            throw new RuntimeException(effect.toString());
        }
      }
      this.processReturnOperation(id, op, toPropagate);
    }

    assert this.state.returnedProxies.size() == ops.size();
  }
1184916
public void processRequest(RequestEvent request) {
    Request req_msg = request.getRequest();
    ToHeader to = (ToHeader) req_msg.getHeader(ToHeader.NAME);
    SipContact my_contact_info = new SipContact();

    synchronized (contactLock) {
      my_contact_info.setContactHeader((ContactHeader) (contactInfo.getContactHeader().clone()));
    }

    // Is it for me? Check: Request-URI = my contact address (I may not be
    // the original 'To' party, also there may be multiple devices for one
    // "me" address of record)
    // If no match, check 'To' = me
    // (so that local messaging without proxy still works) - but ONLY IF
    // setLoopback() has been called

    LOG.trace("request received !");
    LOG.trace("     me ('To' check) = {}", me);
    LOG.trace("     my local contact info ('Request URI' check) = {}", my_contact_info.getURI());
    LOG.trace("     {}" , req_msg.toString());

    if (req_msg.getMethod().equalsIgnoreCase(SipRequest.REGISTER)) {
      if (!isPassThroughRegisterRequests()) {
        if (!isSupportRegisterRequests()) {
          return;
        } else {
          ExpiresHeader expires = req_msg.getExpires();
          if (expires.getExpires() == 0) {
            try {
              Response response = getParent().getMessageFactory().createResponse(Response.OK, request.getRequest());
              sendReply(request, response);
              return;
            } catch (Exception e) {
              LOG.error("Exception while trying to respond to REGISTER with Expires header 0 request");
            }
          }
        }
      }
    } else if (!acceptTrafficOnEphemeralPorts) {
      //Check if destination match
      if (destMatch((SipURI) my_contact_info.getContactHeader().getAddress().getURI(),
              (SipURI) req_msg.getRequestURI()) == false) {
        if (!loopback) {
          LOG.trace("     skipping 'To' check, we're not loopback (see setLoopback())");
          return;
        }

        // check 'To' for a match
        if (to.getAddress().getURI().toString().equals(me) == false) {
          return;
        }
      }
    }

    if (req_msg.getMethod().equalsIgnoreCase(Request.OPTIONS)) {
      int responseCode = Response.OK;
      if (!isAutoResponseOptionsRequests()) {
        if (errorRespondToOptions != -1 ) {
          responseCode = errorRespondToOptions;
        } else {
          return;
        }
      }
      try {
        Response response = getParent().getMessageFactory().createResponse(responseCode, request.getRequest());
        sendReply(request, response);
        lastReceivedOptionsRequest = req_msg;
      } catch (Exception e) {
        LOG.error("Exception while trying to respond to OPTIONS request");
      }
    }

    // check for listener handling
    synchronized (requestListeners) {
      List<RequestListener> listeners = requestListeners.get(req_msg.getMethod());
      if (listeners != null) {
        Iterator<RequestListener> i = listeners.iterator();
        while (i.hasNext()) {
          RequestListener listener = (RequestListener) i.next();
          listener.processEvent(request);
        }
      }
    }

    synchronized (reqBlock) {
      if (rcvRequests == false) {
        LOG.trace("not interested in blocking requests");
        return;
      }

      reqEvents.addLast(request);

      LOG.trace("notifying block object");
      reqBlock.notifyEvent();
    }
  }
286937
def get_response(self):
        
        res = IOCRBlockRes()
        for field in ["IOCRType", "IOCRReference", "FrameID"]:
            res.setfieldval(field, self.getfieldval(field))
        return res
1007298
@SuppressWarnings("PMD.ExceptionAsFlowControl")
  public HttpResponse send() throws IOException {
    HttpResponse response = null;
    for (int attempt = 1; attempt <= numAttempts; ++attempt) {
      entry.withAttempt(attempt);
      try {
        response = sendImpl();
        int s = response.status();
        if (s == 429 || s == 503) {
          // Request is getting throttled, exponentially back off
          // - 429 client sending too many requests
          // - 503 server unavailable
          try {
            long delay = initialRetryDelay << (attempt - 1);
            LOGGER.debug("request throttled, delaying for {}ms: {} {}", delay, method, uri);
            Thread.sleep(delay);
          } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new IOException("request failed " + method + " " + uri, e);
          }
        } else if (s < 500) {
          // 4xx errors other than 429 are not considered retriable, so for anything
          // less than 500 just return the response to the user
          return response;
        }
      } catch (IOException e) {
        // All exceptions are considered retriable. Some like UnknownHostException are
        // debatable, but we have seen them in some cases if there is a high latency for
        // DNS lookups. So for now assume all exceptions are transient issues.
        if (attempt == numAttempts) {
          throw e;
        } else {
          LOGGER.warn("attempt {} of {} failed: {} {}", attempt, numAttempts, method, uri);
        }
      }
    }

    if (response == null) {
      // Should not get here
      throw new IOException("request failed " + method + " " + uri);
    }
    return response;
  }
803889
protected <T, E> T handleResponse(final HttpURLConnection connection,
			final DataTypeDescriptor<T> datad, final DataTypeDescriptor<E> errord)
			throws IOException {
		connection.connect();

		int status = connection.getResponseCode();
		if (status == HttpURLConnection.HTTP_OK) {
			// It's a successful response, try to read the result.
			return readResult(connection, datad);

		} else if (status == APPLICATION_EXC_STATUS) {
			// It's an expected application exception.
			throw (RuntimeException) readApplicationException(connection, errord);

		} else {
			// Something bad happened, try to read the error message.
			throw readError(connection);
		}
	}
1013732
private <T, E> void parseAndCallback(
      RequestInfo<T, E> requestInfo, int statusCode, HttpResponse response)
      throws IOException {
    BatchCallback<T, E> callback = requestInfo.callback;

    HttpHeaders responseHeaders = response.getHeaders();
    HttpUnsuccessfulResponseHandler unsuccessfulResponseHandler =
        requestInfo.request.getUnsuccessfulResponseHandler();

    if (HttpStatusCodes.isSuccess(statusCode)) {
      if (callback == null) {
        // No point in parsing if there is no callback.
        return;
      }
      T parsed = getParsedDataClass(requestInfo.dataClass, response, requestInfo);
      callback.onSuccess(parsed, responseHeaders);
    } else {
      HttpContent content = requestInfo.request.getContent();
      boolean retrySupported = retryAllowed && (content == null || content.retrySupported());
      boolean errorHandled = false;
      boolean redirectRequest = false;
      if (unsuccessfulResponseHandler != null) {
        errorHandled = unsuccessfulResponseHandler.handleResponse(
            requestInfo.request, response, retrySupported);
      }
      if (!errorHandled) {
        if (requestInfo.request.handleRedirect(response.getStatusCode(), response.getHeaders())) {
          redirectRequest = true;
        }
      }
      if (retrySupported && (errorHandled || redirectRequest)) {
        unsuccessfulRequestInfos.add(requestInfo);
      } else {
        if (callback == null) {
          // No point in parsing if there is no callback.
          return;
        }
        E parsed = getParsedDataClass(requestInfo.errorClass, response, requestInfo);
        callback.onFailure(parsed, responseHeaders);
      }
    }
  }
1126510
private byte[] waitForResponse(int minASDULen, int maxASDULen, long timeout)
		throws KNXInvalidResponseException, KNXTimeoutException
	{
		long remaining = timeout;
		final long end = System.currentTimeMillis() + remaining;
		synchronized (indications) {
			while (remaining > 0) {
				try {
					while (indications.size() > 0) {
						final CEMI frame =
							((FrameEvent) indications.remove(0)).getFrame();
						final byte[] apdu = frame.getPayload();
						assert svcResponse == DataUnitBuilder.getAPDUService(apdu);
						if (apdu.length < minASDULen + 2 || apdu.length > maxASDULen + 2) {
							final String s = "invalid ASDU response length "
								+ (apdu.length - 2) + " bytes, expected " + minASDULen
								+ " to " + maxASDULen;
							logger.error("received response with " + s);
							throw new KNXInvalidResponseException(s);
						}
						if (svcResponse == IND_ADDR_RESPONSE
							|| svcResponse == IND_ADDR_SN_RESPONSE)
							return ((CEMILData) frame).getSource().toByteArray();
						indications.clear();
						return apdu;
					}
					indications.wait(remaining);
				}
				catch (final InterruptedException e) {}
				remaining = end - System.currentTimeMillis();
			}
		}
		throw new KNXTimeoutException("timeout occurred while waiting for data response");
	}
40721
private void handleRequestFailure(long requestId, Throwable error, ThreadContext context) {
    ByteBuf buffer = channel.alloc().buffer(10)
      .writeByte(RESPONSE)
      .writeLong(requestId)
      .writeByte(FAILURE);

    try {
      writeError(buffer, error, context);
    } catch (SerializationException e) {
      return;
    }

    channel.writeAndFlush(buffer, channel.voidPromise());
  }
1283950
@Override
  public void requestPollRead()
  {
    /*
    if (log.isLoggable(Level.FINEST)) {
      log.finest("request-wake " + getName()
                 + " (count=" + _port.getThreadCount()
                 + ", idle=" + _port.getIdleThreadCount() + ")");
    }
    */

    try {
      requestLoop();
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }

    /*
    if (_stateRef.get().toWake(_stateRef)) {
      offer(getConnectionTask());
    }
    */
  }
148311
@Override
  public void processResponse(CloseableHttpResponse response) throws IOException, UnexpectedResponseException {
    if (response.getStatusLine().getStatusCode() >= 400) {
      if (response.getEntity() != null) {
        throw new RuntimeException("Failed. " + EntityUtils.toString(response.getEntity())
                                 + " , response: " + ToStringBuilder.reflectionToString(response, ToStringStyle.SHORT_PREFIX_STYLE));
      }
      throw new RuntimeException("Failed. Response: " + ToStringBuilder.reflectionToString(response, ToStringStyle.SHORT_PREFIX_STYLE));
    }
  }
1112255
public <T> T receiveResponse(byte[] bytes, Class<T> returnType) throws IOException, WsonrpcException, RemoteException {
        JsonRpcMessage msg;
        try {
            msg = receive(bytes);
        } catch (JsonException e) {
            throw new WsonrpcException("parse response error", e);
        }
        if (msg instanceof JsonRpcResponse) {
            return convertResponse((JsonRpcResponse) msg, returnType);
        } else {
            throw new WsonrpcException("invalid response");
        }
    }
597046
def retrieve(self, request, project, pk=None):
        
        try:
            serializer = JobNoteSerializer(JobNote.objects.get(id=pk))
            return Response(serializer.data)
        except JobNote.DoesNotExist:
            return Response("No note with id: {0}".format(pk), status=HTTP_404_NOT_FOUND)
12408
public ApiSuccessResponse getContactDetails(String id, ContactDetailsData contactDetailsData) throws ApiException {
        ApiResponse<ApiSuccessResponse> resp = getContactDetailsWithHttpInfo(id, contactDetailsData);
        return resp.getData();
    }