Sends 5 {@link HelloReply} responses when receiving a request.

@see #lazyHello(HelloRequest, StreamObserver)
8324
@Override
    public void lotsOfReplies(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
        // You can also write this code without Reactor like 'lazyHello' example.
        Flux.interval(Duration.ofSeconds(1))
            .take(5)
            .map(index -> "Hello, " + request.getName() + "! (sequence: " + (index + 1) + ')')
            // You can make your Flux/Mono publish the signals in the RequestContext-aware executor.
            .publishOn(Schedulers.fromExecutor(RequestContext.current().contextAwareExecutor()))
            .subscribe(message -> {
                           // Confirm this callback is being executed on the RequestContext-aware executor.
                           final ServiceRequestContext ctx = RequestContext.current();
                           responseObserver.onNext(buildReply(message));
                       },
                       cause -> {
                           // Confirm this callback is being executed on the RequestContext-aware executor.
                           final ServiceRequestContext ctx = RequestContext.current();
                           responseObserver.onError(cause);
                       },
                       () -> {
                           // Confirm this callback is being executed on the RequestContext-aware executor.
                           final ServiceRequestContext ctx = RequestContext.current();
                           responseObserver.onCompleted();
                       });
    }
570101
public void pingLoop() {
        if ( ! isStopped() ) {
            Log.Info(this, "----------- START MULTI RESPONSE REQUEST ------------");
            mediator.askSubscribers(self(), "defaultTopic", "Hello from " + myName,
                (reply, error) -> {
                    if (Actors.isComplete(error)) {
                        Log.Info(this,"----------- ALL RESULTS RECEIVED ------------");
                        delayed(5000, () -> pingLoop());
                    } else {
                        Log.Info(this,"=>" + reply);
                    }
                });
        }
    }
951137
@Override
    public VirtualConnection readNextResponse(InterChannelCallback cb, boolean forceQueue) {
        if (null == cb) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "readNext: Invalid null callback as input.");
            }
            throw new NullPointerException("Null callback");
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "App channel requesting next response on " + getVC());
            Tr.debug(tc, "Async forcequeue flag is " + forceQueue);
        }
        this.bTempResponsesUsed = true;
        return startEarlyRead(cb, forceQueue);
    }
804976
private void sendSomeRequests() {
		ResponseListener responseListener = new MyResponseListener();

		sendCustomUrlRequest(responseListener);
		sendAutoRetryRequest(responseListener);
		downloadImage(responseListener);
		uploadData(responseListener);
		uploadFile(responseListener);
		uploadText(responseListener);
	}
1310106
@Override
    public StreamObserver<HelloRequest> bidiHello(StreamObserver<HelloReply> responseObserver) {
        return new StreamObserver<HelloRequest>() {
            @Override
            public void onNext(HelloRequest value) {
                // Respond to every request received.
                responseObserver.onNext(buildReply(toMessage(value.getName())));
            }

            @Override
            public void onError(Throwable t) {
                responseObserver.onError(t);
            }

            @Override
            public void onCompleted() {
                responseObserver.onCompleted();
            }
        };
    }
302122
private void sendResponse(final HttpServletResponse res, final CmsSpellcheckingRequest request) throws IOException {

        final PrintWriter pw = res.getWriter();
        final JSONObject response = getJsonFormattedSpellcheckResult(request);
        pw.println(response.toString());
        pw.close();
    }
34033
public function sendHello() {

        $helloXML = new SimpleXMLElement("<capabilities> </capabilities>");

        foreach ($this->myCapabilities as $capability) {

            $helloXML->addChild("capability", $capability);

        }

        $this->sendRaw(
            $helloXML->asXML(),
            "hello",
            null,
            [],
            false
        );

    }
322832
public synchronized Http2HeadersStreamSinkChannel createStream(HeaderMap requestHeaders) throws IOException {
        if (!isClient()) {
            throw UndertowMessages.MESSAGES.headersStreamCanOnlyBeCreatedByClient();
        }
        if (!isOpen()) {
            throw UndertowMessages.MESSAGES.channelIsClosed();
        }
        sendConcurrentStreamsAtomicUpdater.incrementAndGet(this);
        if(sendMaxConcurrentStreams > 0 && sendConcurrentStreams > sendMaxConcurrentStreams) {
            throw UndertowMessages.MESSAGES.streamLimitExceeded();
        }
        int streamId = streamIdCounter;
        streamIdCounter += 2;
        Http2HeadersStreamSinkChannel http2SynStreamStreamSinkChannel = new Http2HeadersStreamSinkChannel(this, streamId, requestHeaders);
        currentStreams.put(streamId, new StreamHolder(http2SynStreamStreamSinkChannel));

        return http2SynStreamStreamSinkChannel;
    }
212615
public SoapServerResponseActionBuilder send() {
        SoapServerResponseActionBuilder soapServerResponseActionBuilder = new SoapServerResponseActionBuilder(action, soapServer)
                .withApplicationContext(applicationContext);
        return soapServerResponseActionBuilder;
    }
249783
def hello(environ, start_response):
    ''''''
    if environ['REQUEST_METHOD'] == 'GET':
        data = b'Hello World!\n'
        status = '200 OK'
        response_headers = [
            ('Content-type', 'text/plain'),
            ('Content-Length', str(len(data)))
        ]
        start_response(status, response_headers)
        return iter([data])
    else:
        raise MethodNotAllowed
1216802
public boolean send()
	{
		assert sentRequests == null;
		sentRequests = new ArrayList<RequestCallInfo>();

		// add prepended requests,
		addPrependedRequests( sentRequests );

		// add requests to send
		while( !requestsToSend.isEmpty() )
			sentRequests.add( requestsToSend.remove( 0 ) );

		// add appended requests
		addAppendedRequests( sentRequests );

		// prepare payload
		JSONArray payload = createPayload();

		RequestBuilder builderPost = buildMultipart( "payload", payload.toString() );

		nbSentBytes += builderPost.getRequestData().length();

		try
		{
			sentRequest = builderPost.send();
		}
		catch( RequestException e )
		{
			callback.error( RPCErrorCodes.ERROR_REQUEST_SEND, e, this );
			return false;
		}

		callback.sent( this );

		return true;
	}
969648
private void sendResponse(ChannelHandlerContext ctx, int streamId, ByteBuf payload) {
        // Send a frame for the response status
        Http2Headers headers = new DefaultHttp2Headers().status(OK.codeAsText());
        encoder().writeHeaders(ctx, streamId, headers, 0, false, ctx.newPromise());
        encoder().writeData(ctx, streamId, payload, 0, true, ctx.newPromise());

        // no need to call flush as channelReadComplete(...) will take care of it.
    }
1103257
@Override
    public void sendResponse(StoreStats performanceStats,
                             boolean isFromLocalZone,
                             long startTimeInMs) throws Exception {

        /*
         * Pay attention to the code below. Note that in this method we wrap a multiPart object with a mimeMessage.
         * However when writing to the outputStream we only send the multiPart object and not the entire
         * mimeMessage. This is intentional.
         *
         * In the earlier version of this code we used to create a multiPart object and just send that multiPart
         * across the wire.
         *
         * However, we later discovered that upon setting the content of a MimeBodyPart, JavaMail internally creates
         * a DataHandler object wrapping the object you passed in. The part's Content-Type header is not updated
         * immediately. In order to get the headers updated, one needs to to call MimeMessage.saveChanges() on the
         * enclosing message, which cascades down the MIME structure into a call to MimeBodyPart.updateHeaders()
         * on the body part. It's this updateHeaders call that transfers the content type from the
         * DataHandler to the part's MIME Content-Type header.
         *
         * To make sure that the Content-Type headers are being updated (without changing too much code), we decided
         * to wrap the multiPart in a mimeMessage, call mimeMessage.saveChanges() and then just send the multiPart.
         * This is to make sure multiPart's headers are updated accurately.
         */

        MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
        // multiPartKeys is the outer multipart
        MimeMultipart multiPartKeys = new MimeMultipart();
        ByteArrayOutputStream keysOutputStream = new ByteArrayOutputStream();

        for(Entry<ByteArray, List<Versioned<byte[]>>> entry: versionedResponses.entrySet()) {
            ByteArray key = entry.getKey();
            String base64Key = RestUtils.encodeVoldemortKey(key.get());
            String contentLocationKey = "/" + this.storeName + "/" + base64Key;

            // Create the individual body part - for each key requested
            MimeBodyPart keyBody = new MimeBodyPart();
            try {
                // Add the right headers
                keyBody.addHeader(CONTENT_TYPE, "application/octet-stream");
                keyBody.addHeader(CONTENT_TRANSFER_ENCODING, "binary");
                keyBody.addHeader(CONTENT_LOCATION, contentLocationKey);
            } catch(MessagingException me) {
                logger.error("Exception while constructing key body headers", me);
                keysOutputStream.close();
                throw me;
            }
            // multiPartValues is the inner multipart
            MimeMultipart multiPartValues = new MimeMultipart();
            for(Versioned<byte[]> versionedValue: entry.getValue()) {

                byte[] responseValue = versionedValue.getValue();

                VectorClock vectorClock = (VectorClock) versionedValue.getVersion();
                String eTag = RestUtils.getSerializedVectorClock(vectorClock);
                numVectorClockEntries += vectorClock.getVersionMap().size();

                // Create the individual body part - for each versioned value of
                // a key
                MimeBodyPart valueBody = new MimeBodyPart();
                try {
                    // Add the right headers
                    valueBody.addHeader(CONTENT_TYPE, "application/octet-stream");
                    valueBody.addHeader(CONTENT_TRANSFER_ENCODING, "binary");
                    valueBody.addHeader(RestMessageHeaders.X_VOLD_VECTOR_CLOCK, eTag);
                    valueBody.setContent(responseValue, "application/octet-stream");
                    valueBody.addHeader(RestMessageHeaders.CONTENT_LENGTH,
                                        Integer.toString(responseValue.length));

                    multiPartValues.addBodyPart(valueBody);
                } catch(MessagingException me) {
                    logger.error("Exception while constructing value body part", me);
                    keysOutputStream.close();
                    throw me;
                }

            }
            try {
                // Add the inner multipart as the content of the outer body part
                keyBody.setContent(multiPartValues);
                multiPartKeys.addBodyPart(keyBody);
            } catch(MessagingException me) {
                logger.error("Exception while constructing key body part", me);
                keysOutputStream.close();
                throw me;
            }

        }
        message.setContent(multiPartKeys);
        message.saveChanges();
        try {
            multiPartKeys.writeTo(keysOutputStream);
        } catch(Exception e) {
            logger.error("Exception while writing mutipart to output stream", e);
            throw e;
        }

        ChannelBuffer responseContent = ChannelBuffers.dynamicBuffer();
        responseContent.writeBytes(keysOutputStream.toByteArray());

        // Create the Response object
        HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);

        // Set the right headers
        response.setHeader(CONTENT_TYPE, "multipart/binary");
        response.setHeader(CONTENT_TRANSFER_ENCODING, "binary");

        // Copy the data into the payload
        response.setContent(responseContent);
        response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes());

        // Write the response to the Netty Channel
        if(logger.isDebugEnabled()) {
            String keyStr = getKeysHexString(this.versionedResponses.keySet());
            debugLog("GET_ALL",
                     this.storeName,
                     keyStr,
                     startTimeInMs,
                     System.currentTimeMillis(),
                     numVectorClockEntries);
        }
        this.messageEvent.getChannel().write(response);

        if(performanceStats != null && isFromLocalZone) {
            recordStats(performanceStats, startTimeInMs, Tracked.GET_ALL);
        }

        keysOutputStream.close();
    }
1191130
function sayHello(call, callback) {
  var reply = new messages.HelloReply();
  reply.setMessage('Hello ' + call.request.getName());
  callback(null, reply);
}
693721
public void execute() throws HelloSignException {
        HttpURLConnection connection = getConnection();
        try {
            // Execute the request and save the HTTP status code
            lastHttpStatusCode = connection.getResponseCode();

            // Save the stream object for processing
            if (lastHttpStatusCode >= 200 && lastHttpStatusCode < 300) {
                logger.debug("OK!");
                lastResponseStream = connection.getInputStream();
            } else {
                logger.error("Error! HTTP Code = " + lastHttpStatusCode);
                lastResponseStream = connection.getErrorStream();
            }
        } catch (Exception ex) {
            throw new HelloSignException(ex);
        }
    }
639416
function _sendFrameStreamResponse(frame, timeoutMs, responseFrameType) {
        var frameId = xbeeAPI.nextFrameId(),
            sendStream,
            resultStream;

        // Set the frame ID and create the callback to check for it
        frame.id = frameId;

        // Result is the first frame that matches the frame ID and response type
        resultStream = frameSource
            .pipe(rx.operators.filter(_createFilter(frameId, responseFrameType)),
                  rx.operators.takeUntil(rx.timer(timeoutMs)));

        sendStream = rx.Observable.create(function (observer) {
            if (debug) {
                console.log("Debug frame (out):\n", xbeeAPI.buildFrame(frame));
            }

            xbeeAPI.builder.write(frame);
            observer.complete();
        });

        // Return our result stream with a timeout
        return rx.merge(sendStream, resultStream).pipe(
            rx.operators.timeoutWith(timeoutMs, rx.throwError(new Error("Timed out after " + timeoutMs + " ms")))
        );
    }
757150
private <T> T send(String method, TypeReference<T> responseType, @Nullable Object entity) {
        try {
            InputStream responseStream = entity == null ?
                    builder().method(method, InputStream.class) :
                    builder().method(method, InputStream.class, entity);

            return EntityHelper.getEntity(responseStream, responseType);
        } catch (UniformInterfaceException e) {
            throw asEmoClientException(e);
        }
    }