Package com.yahoo.container.jdisc
Class RequestHandlerTestDriver.MockResponseHandler
java.lang.Object
com.yahoo.container.jdisc.RequestHandlerTestDriver.MockResponseHandler
- All Implemented Interfaces:
com.yahoo.jdisc.handler.ResponseHandler
- Enclosing class:
- RequestHandlerTestDriver
public static class RequestHandlerTestDriver.MockResponseHandler
extends Object
implements com.yahoo.jdisc.handler.ResponseHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of bytes available in the handler right nowBlocks until there's a response (max 60 seconds).void
com.yahoo.jdisc.Response
int
Returns the status code.com.yahoo.jdisc.handler.ContentChannel
handleResponse
(com.yahoo.jdisc.Response response) read()
Read the next piece of data from this channel, blocking if needed.readAll()
Reads all data that will ever be produced by the channel attached to this, blocking as necessary.Consumes all currently available data, or returns "" if no data is available right now.
-
Constructor Details
-
MockResponseHandler
public MockResponseHandler()
-
-
Method Details
-
awaitResponse
Blocks until there's a response (max 60 seconds). Returns this for chaining convenience- Throws:
InterruptedException
-
read
Read the next piece of data from this channel, blocking if 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
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
Consumes all currently available data, or returns "" 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 interfacecom.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()
-