1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
From: Markus Koschany <apo@debian.org>
Date: Sun, 13 Nov 2022 14:45:22 +0100
Subject: no-reactivex-support
Requires new build dependency.
Forwarded: not-needed
---
.../examples/ReactiveClientFullDuplexExchange.java | 98 ----------------------
1 file changed, 98 deletions(-)
delete mode 100644 httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-package org.apache.hc.client5.http.examples;
-
-import java.net.URI;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
-import org.apache.hc.client5.http.impl.async.MinimalHttpAsyncClient;
-import org.apache.hc.core5.http.ContentType;
-import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.Message;
-import org.apache.hc.core5.http.config.Http1Config;
-import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
-import org.apache.hc.core5.http2.config.H2Config;
-import org.apache.hc.core5.io.CloseMode;
-import org.apache.hc.core5.reactive.ReactiveEntityProducer;
-import org.apache.hc.core5.reactive.ReactiveResponseConsumer;
-import org.apache.hc.core5.reactor.IOReactorConfig;
-import org.reactivestreams.Publisher;
-
-import io.reactivex.rxjava3.core.Flowable;
-import io.reactivex.rxjava3.core.Observable;
-
-/**
- * This example demonstrates a reactive, full-duplex HTTP/1.1 message exchange using RxJava.
- */
-public class ReactiveClientFullDuplexExchange {
-
- public static void main(final String[] args) throws Exception {
-
- final MinimalHttpAsyncClient client = HttpAsyncClients.createMinimal(
- H2Config.DEFAULT,
- Http1Config.DEFAULT,
- IOReactorConfig.DEFAULT);
-
- client.start();
-
- final URI requestUri = new URI("http://httpbin.org/post");
- final byte[] bs = "stuff".getBytes(StandardCharsets.UTF_8);
- final ReactiveEntityProducer reactiveEntityProducer = new ReactiveEntityProducer(
- Flowable.just(ByteBuffer.wrap(bs)), bs.length, ContentType.TEXT_PLAIN, null);
- final BasicRequestProducer requestProducer = new BasicRequestProducer(
- "POST", requestUri, reactiveEntityProducer);
-
- final ReactiveResponseConsumer consumer = new ReactiveResponseConsumer();
- final Future<Void> requestFuture = client.execute(requestProducer, consumer, null);
- final Message<HttpResponse, Publisher<ByteBuffer>> streamingResponse = consumer.getResponseFuture().get();
-
- System.out.println(streamingResponse.getHead());
- for (final Header header : streamingResponse.getHead().getHeaders()) {
- System.out.println(header);
- }
- System.out.println();
-
- Observable.fromPublisher(streamingResponse.getBody())
- .map(byteBuffer -> {
- final byte[] string = new byte[byteBuffer.remaining()];
- byteBuffer.get(string);
- return new String(string);
- })
- .materialize()
- .forEach(System.out::println);
-
- requestFuture.get(1, TimeUnit.MINUTES);
-
- System.out.println("Shutting down");
- client.close(CloseMode.GRACEFUL);
- }
-}
|