Blocks until response timeout occurs or the response arrives.

@return Bytes of the TCP response.
499699
public synchronized TLVElement getResult() throws KSITCPTransactionException {
        if (finished) {
            if (response != null) {
                return response;
            }
            if (exception != null) {
                throw exception;
            }
        }
        return blockUntilTransactionFinished();
    }
653261
public String getresp(int timeout)
    throws SoccomException
    {
    int size, n;
    String sizestr;
    try {
        byte[] _header = new byte[SoccomMessage.HEADER_SIZE];
        _socket.setSoTimeout(timeout*1000);
        n = _in.read(_header, 0, SoccomMessage.HEADER_SIZE);
        if (n!=SoccomMessage.HEADER_SIZE)
        throw new SoccomException(SoccomException.RECV_HEADER);
        logline("RECV HDR: " + new String(_header));
        check_msgid(_msgid, _header);
        sizestr = new String(_header, SoccomMessage.MSGSIZE_OFFSET, 8);
        if (sizestr.startsWith("ENDM")) size = -1;
        else size = Integer.parseInt(sizestr);
    } catch (InterruptedIOException e) {
        throw new SoccomException(SoccomException.POLL_TIMEOUT);
    } catch (IOException e) {
        throw new SoccomException(SoccomException.RECV_HEADER);
    }
    try {
        String msg;
        if (size == -1) {
        String endm = sizestr.substring(4,8);
        String line;
        StringBuffer sb = new StringBuffer();
        byte[] buffer = new byte[1024];
        int k;
        boolean done = false;
        while (!done) {
            k = readLine(_in, buffer, 0, 1024);
            line = new String(buffer,0,k);
            if (k==5 && line.startsWith(endm)) done = true;
            else sb.append(line);
        }
        msg = sb.toString();
        } else {
        byte[] buffer = new byte[size+SoccomMessage.HEADER_SIZE];
        int got = 0;
        while (got<size) {
            n = _in.read(buffer, got, size-got);
            if (n>0) got += n;
            else if (n==-1)
            throw new SoccomException(SoccomException.SOCKET_CLOSED);
            else throw new SoccomException(SoccomException.RECV_ERROR);
        }
        msg = new String(buffer, 0, size);
        }
        logline("RECV MSG: " + msg);
        return msg;
    } catch (InterruptedIOException e) {
        throw new SoccomException(SoccomException.RECV_ERROR);
    } catch (IOException e) {
        throw new SoccomException(SoccomException.RECV_ERROR);
    }
    }
688416
public T get() throws Exception {
    waitForPromiseSuccess();

    if (response != null) {
      return response;
    } else {
      if (this.exception instanceof IOException) {
        throw (IOException) this.exception;
      } else if (this.exception instanceof io.netty.handler.timeout.TimeoutException) {
        throw new TimeoutException();
      } else {
        throw new IOException(this.exception);
      }
    }
  }
700112
protected int getTimeoutForResponse() {
        String timeout_s = null;
        int timeout;
        try {
            timeout_s = this.getAttributeValueSmart(TIMEOUT);
            timeout = timeout_s==null?30:Integer.parseInt(timeout_s);
            if (timeout<0) timeout = 30;
        } catch (NumberFormatException e) {
            logger.severeException("Cannot parse timeout value " + timeout_s, e);
            timeout = 30;
        } catch (PropertyException e) {
            logger.severeException("Cannot read timeout attribute " + TIMEOUT, e);
            timeout = 30;
        }
        return timeout;
    }
1369668
@GET
    public Response getStreamContents() {

        // Intercept all output
        StreamingOutput stream = new StreamingOutput() {

            @Override
            public void write(OutputStream output) throws IOException {
                try {
                    tunnel.interceptStream(streamIndex, output);
                }
                catch (GuacamoleException e) {
                    throw new IOException(e);
                }
            }

        };

        // Begin successful response
        ResponseBuilder responseBuilder = Response.ok(stream, mediaType);

        // Set Content-Disposition header for "application/octet-stream"
        if (mediaType.equals(MediaType.APPLICATION_OCTET_STREAM))
            responseBuilder.header("Content-Disposition", "attachment");

        return responseBuilder.build();

    }
727161
public static HttpResponse getResponse(String urls, HttpRequest request,
                                           HttpMethod method, int connectTimeoutMillis, int readTimeoutMillis) throws IOException {
        OutputStream out = null;
        InputStream content = null;
        HttpResponse response = null;
        HttpURLConnection httpConn = request
            .getHttpConnection(urls, method.name());
        httpConn.setConnectTimeout(connectTimeoutMillis);
        httpConn.setReadTimeout(readTimeoutMillis);

        try {
            httpConn.connect();
            if (null != request.getPayload() && request.getPayload().length > 0) {
                out = httpConn.getOutputStream();
                out.write(request.getPayload());
            }
            content = httpConn.getInputStream();
            response = new HttpResponse();
            parseHttpConn(response, httpConn, content);
            return response;
        } catch (SocketTimeoutException e) {
            throw e;
        } catch (IOException e) {
            content = httpConn.getErrorStream();
            response = new HttpResponse();
            parseHttpConn(response, httpConn, content);
            return response;
        } finally {
            if (content != null) {
                content.close();
            }
            httpConn.disconnect();
        }
    }
938290
protected int processResponse(byte[] b) {
        if ( DumpProtocol ) {
            try {
                System.out.println("resp:"+new String(b,"UTF-8"));
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        Object o[] = (Object[]) conf.asObject(b);
        if ( SENDDEBUG )
            System.out.println("RECEIVE:"+(o.length-1));
        int seq = ((Number) o[o.length - 1]).intValue();
        if ( seq == lastSeenSeq+1 || lastSeenSeq == 0 || noSeqChecking ) {
            lastSeenSeq = seq;
            processDecodedResultArray(o);
            Object next[];
            while ( (next = (Object[]) sequenceCache.get(lastSeenSeq + 1)) != null ) {
                lastSeenSeq++;
                sequenceCache.remove(lastSeenSeq);
                log("replay "+lastSeenSeq);
                processDecodedResultArray(next);
            }
        } else {
            log("ignored result with sequence:" + seq + " lastSeen:" + lastSeenSeq);
            if ( seq > lastSeenSeq ) {
                sequenceCache.put(seq,o);
                if ( sequenceCache.size() > 5 ) {
                    disconnect("Unrecoverable Gap");
                }
            }
        }
        return o.length-1;
    }
259671
@Override
  public int readTimeout(byte []buf, int offset, int length, long timeout)
    throws IOException
  {
    Socket s = _s;
      
    if (s == null) {
      return -1;
    }
    
    int oldTimeout = s.getSoTimeout();
    s.setSoTimeout((int) timeout);
    
    try {
      int result = read(buf, offset, length);
      
      if (result >= 0) {
        return result;
      }
      else if (_is == null || _is.available() < 0) {
        return -1;
      }
      else {
        return ReadStream.READ_TIMEOUT;
      }
    } finally {
      s.setSoTimeout(oldTimeout);
    }
  }
520576
protected HttpServletResponse getCurrentResponse() {
        final HttpServletResponse response = httpService.getCurrentResponse();
        if (response == null) {
            throw new IllegalStateException("No HttpServletResponse bound to current thread");
        }
        return response;
    }
48286
public synchronized int getSoTimeout() throws IOException {
        if (isClosed())
            throw new SocketException("Socket is closed");
        Object o = getImpl().getOption(SocketOptions.SO_TIMEOUT);
        /* extra type safety */
        if (o instanceof Integer) {
            return ((Integer) o).intValue();
        } else {
            return 0;
        }
    }
584668
public byte[] getWriterBytes() {

        if (isSuspended()) {
            // No output whatsoever if the response is suspended
            return new byte[0];
        }
        if (m_cacheBytes != null) {
            // Optimization for cached "leaf" nodes, here I re-use the array from the cache
            return m_cacheBytes;
        }
        if (m_out == null) {
            // No output was written so far, just return an empty array
            return new byte[0];
        }
        if (m_writer != null) {
            // Flush the writer in case something was written on it
            m_writer.flush();
        }
        return m_out.getBytes();
    }
952462
public byte[] getBytes() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getBytes");

    byte[] b = null;
    try {
      b = string().getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
      FFDCFilter.processException(e, className + ".getBytes", "2", this);
    }

    byte[] c = new byte[b.length+1];

    c[0] = Cellule.LINKCELLULE;
    for (int i=0; i < b.length; i++) {
      c[i+1] = b[i];
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getBytes", c);
    return c;
  }
868002
public CloseableHttpResponse getCloseableHttpResponse() {
        ContentType resultContentType = null;
        if (this.contentType != null) {
            resultContentType = ContentType.create(this.contentType, characterEncoding);
        }
        if (internalWriter != null) {
            writer.flush();
            httpClientResponse.setEntity(new StringEntity(internalWriter.toString(), resultContentType));
        } else if (internalOutputStream != null) {
            try {
                outputStream.flush();
            } catch (IOException e) {
                // Nothing to do;
            }
            httpClientResponse.setEntity(new ByteArrayEntity(internalOutputStream.toByteArray(), resultContentType));
        }
        if (!capture) {
            // The result has already been written to the response, let's close
            // the response stream
            if (responseWriter != null) {
                responseWriter.close();
            }
            if (responseOutputStream != null) {
                try {
                    responseOutputStream.close();
                } catch (IOException e) {
                    LOG.warn("Could not close servlet output stream: " + e.getMessage());
                }
            }
        }
        return httpClientResponse;
    }
242624
private static List<ResponsePacket> readResponses(Socket socket) {
		List<ResponsePacket> responses = new Vector<ResponsePacket>();
		int previousTimeout = 0;
		try {
			/* Set socket timeout to avoid getting stuck on read() */
			try {
				previousTimeout = socket.getSoTimeout();
				socket.setSoTimeout(TIMEOUT);
			} catch (Exception e) {
			}
			InputStream input = socket.getInputStream();
			while (true) {
				ResponsePacket packet = readResponsePacketData(input);
				if (packet != null) responses.add(packet);
				else break;
			}

		} catch (Exception e) {
			/* Ignore exception, as we are expecting timeout exceptions because Apple might not reply anything */
			//System.out.println(e);
		}
		/* Reset socket timeout, just in case */
		try {
			socket.setSoTimeout(previousTimeout);
		} catch (Exception e) {
		}
		//System.out.println("Received "+responses.size()+" response packets");
		return responses;
	}
420139
public synchronized Response<ByteArray, Object> responseQueuePoll(long timeout,
                                                                      TimeUnit timeUnit)
            throws InterruptedException {
        long timeoutMs = timeUnit.toMillis(timeout);
        long timeoutWallClockMs = System.currentTimeMillis() + timeoutMs;
        while(responseQueue.isEmpty() && System.currentTimeMillis() < timeoutWallClockMs) {
            long remainingMs = Math.max(0, timeoutWallClockMs - System.currentTimeMillis());
            if(logger.isDebugEnabled()) {
                logger.debug("Start waiting for response queue with timeoutMs: " + timeoutMs);
            }
            this.wait(remainingMs);
            if(logger.isDebugEnabled()) {
                logger.debug("End waiting for response queue with timeoutMs: " + timeoutMs);
            }
        }
        return responseQueue.poll();
    }
36268
def get_response(self):
        
        self.sock.setblocking(0)
        our_data = []
        # Beginning time
        begin = time.time()
        while True:
            # If we have data then if we're passed the timeout break
            if our_data and time.time() - begin > self.HTTP_TIMEOUT:
                break
            # If we're dataless wait just a bit
            elif time.time() - begin > self.HTTP_TIMEOUT * 2:
                break
            # Recv data
            try:
                data = self.sock.recv(self.RECEIVE_BYTES)
                if data:
                    our_data.append(data)
                    begin = time.time()
                else:
                    # Sleep for sometime to indicate a gap
                    time.sleep(self.HTTP_TIMEOUT)
            except socket.error as err:
                # Check if we got a timeout
                if err.errno == errno.EAGAIN:
                    pass
                # SSL will return SSLWantRead instead of EAGAIN
                elif sys.platform == 'win32' and \
                err.errno == errno.WSAEWOULDBLOCK:
                        pass
                elif (self.request_object.protocol == 'https' and
                    err[0] == ssl.SSL_ERROR_WANT_READ):
                        continue
                # If we didn't it's an error
                else:
                    raise errors.TestError(
                        'Failed to connect to server',
                        {
                            'host': self.request_object.dest_addr,
                            'port': self.request_object.port,
                            'proto': self.request_object.protocol,
                            'message': err,
                            'function': 'http.HttpUA.get_response'
                        })
        if ''.join(our_data) == '':
            raise errors.TestError(
                'No response from server. Request likely timed out.',
                {
                    'host': self.request_object.dest_addr,
                    'port': self.request_object.port,
                    'proto': self.request_object.protocol,
                    'msg': 'Please send the request and check Wireshark',
                    'function': 'http.HttpUA.get_response'
                })                                    
        self.response_object = HttpResponse(''.join(our_data), self)
        try:
            self.sock.shutdown(1)
            self.sock.close()
        except socket.error as err:
            raise errors.TestError(
                'We were unable to close the socket as expected.',
                {
                    'msg': err,
                    'function': 'http.HttpUA.get_response'
                })
1106111
@SuppressWarnings("unchecked")
  public final <T> GetsResponse<T> gets(final String key, final long timeout,
      final Transcoder<T> transcoder)
      throws TimeoutException, InterruptedException, MemcachedException {
    return (GetsResponse<T>) this.get0(key, timeout, CommandType.GETS_ONE, transcoder);
  }