org.apache.hc.client5.testing.async

## Class AsyncRandomHandler

- java.lang.Object
- - org.apache.hc.client5.testing.async.AsyncRandomHandler

- All Implemented Interfaces:
    AsyncDataConsumer, AsyncDataExchangeHandler, AsyncDataProducer, AsyncServerExchangeHandler, ResourceHolder

      public class AsyncRandomHandler
      extends Object
      implements AsyncServerExchangeHandler

  A handler that generates random data.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AsyncRandomHandler.RandomBinAsyncEntityProducer` An entity that generates random data.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AsyncRandomHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `available()`
    `void` | `consume(ByteBuffer src)`
    `void` | `failed(Exception cause)`
    `void` | `handleRequest(HttpRequest request, EntityDetails entityDetails, ResponseChannel responseChannel, HttpContext context)`
    `void` | `produce(DataStreamChannel channel)`
    `void` | `releaseResources()`
    `void` | `streamEnd(List<? extends Header> trailers)`
    `void` | `updateCapacity(CapacityChannel capacityChannel)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AsyncRandomHandler

          public AsyncRandomHandler()

  - ### Method Detail

    - #### releaseResources

          public void releaseResources()

      Specified by:
        `releaseResources` in interface `ResourceHolder`

    - #### handleRequest

          public void handleRequest(HttpRequest request,
                                    EntityDetails entityDetails,
                                    ResponseChannel responseChannel,
                                    HttpContext context)
                             throws HttpException,
                                    IOException

      Specified by:
        `handleRequest` in interface `AsyncServerExchangeHandler`
      Throws:
        `HttpException`
        `IOException`

    - #### updateCapacity

          public void updateCapacity(CapacityChannel capacityChannel)
                              throws IOException

      Specified by:
        `updateCapacity` in interface `AsyncDataConsumer`
      Throws:
        `IOException`

    - #### consume

          public void consume(ByteBuffer src)
                       throws IOException

      Specified by:
        `consume` in interface `AsyncDataConsumer`
      Throws:
        `IOException`

    - #### streamEnd

          public void streamEnd(List<? extends Header> trailers)
                         throws HttpException,
                                IOException

      Specified by:
        `streamEnd` in interface `AsyncDataConsumer`
      Throws:
        `HttpException`
        `IOException`

    - #### available

          public int available()

      Specified by:
        `available` in interface `AsyncDataProducer`

    - #### produce

          public void produce(DataStreamChannel channel)
                       throws IOException

      Specified by:
        `produce` in interface `AsyncDataProducer`
      Throws:
        `IOException`

    - #### failed

          public void failed(Exception cause)

      Specified by:
        `failed` in interface `AsyncDataExchangeHandler`

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.