Class RequestHandlerTestDriver.MockResponseHandler

  • All Implemented Interfaces:
    com.yahoo.jdisc.handler.ResponseHandler
    Enclosing class:
    RequestHandlerTestDriver

    public static class RequestHandlerTestDriver.MockResponseHandler
    extends java.lang.Object
    implements com.yahoo.jdisc.handler.ResponseHandler
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()
      Returns the number of bytes available in the handler right now
      RequestHandlerTestDriver.MockResponseHandler awaitResponse()
      Blocks until there's a response (max 60 seconds).
      void clientClose()  
      com.yahoo.jdisc.Response getResponse()  
      int getStatus()
      Returns the status code.
      com.yahoo.jdisc.handler.ContentChannel handleResponse​(com.yahoo.jdisc.Response response)  
      java.lang.String read()
      Read the next piece of data from this channel even it blocking is needed.
      java.lang.String readAll()
      Reads all data that will ever be produced by the channel attached to this, blocking as necessary.
      java.lang.String readIfAvailable()
      Consumes all currently available data, or return "" if no data is available right now.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MockResponseHandler

        public MockResponseHandler()
    • Method Detail

      • awaitResponse

        public RequestHandlerTestDriver.MockResponseHandler awaitResponse()
                                                                   throws java.lang.InterruptedException
        Blocks until there's a response (max 60 seconds). Returns this for chaining convenience
        Throws:
        java.lang.InterruptedException
      • read

        public java.lang.String read()
        Read the next piece of data from this channel even it blocking is needed. If all data is already read, this returns null.
      • available

        public int available()
        Returns the number of bytes available in the handler right now
      • readAll

        public java.lang.String readAll()
        Reads all data that will ever be produced by the channel attached to this, blocking as necessary. Returns an empty string if there is no data.
      • readIfAvailable

        public java.lang.String readIfAvailable()
        Consumes all currently available data, or return "" if no data is available right now. Never blocks.
      • handleResponse

        public com.yahoo.jdisc.handler.ContentChannel handleResponse​(com.yahoo.jdisc.Response response)
        Specified by:
        handleResponse in interface com.yahoo.jdisc.handler.ResponseHandler
      • clientClose

        public void clientClose()
      • getStatus

        public int getStatus()
        Returns the status code. Throws an exception if handleResponse is not called prior to calling this
      • getResponse

        public com.yahoo.jdisc.Response getResponse()