public static class RequestHandlerTestDriver.MockResponseHandler extends Object implements com.yahoo.jdisc.handler.ResponseHandler
Modifier and Type | Field and Description |
---|---|
private com.yahoo.jdisc.handler.BufferedContentChannel |
buffer |
private com.yahoo.jdisc.handler.ReadableContentChannel |
content |
private CountDownLatch |
latch |
(package private) com.yahoo.jdisc.Response |
response |
Constructor and Description |
---|
MockResponseHandler() |
Modifier and Type | Method and 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) |
String |
read()
Read the next piece of data from this channel even it blocking is needed.
|
String |
readAll()
Reads all data that will ever be produced by the channel attached to this, blocking as necessary.
|
String |
readIfAvailable()
Consumes all currently available data, or return "" if no data is available right now.
|
private final CountDownLatch latch
private final com.yahoo.jdisc.handler.ReadableContentChannel content
private final com.yahoo.jdisc.handler.BufferedContentChannel buffer
com.yahoo.jdisc.Response response
public RequestHandlerTestDriver.MockResponseHandler awaitResponse() throws InterruptedException
InterruptedException
public String read()
public int available()
public String readAll()
public String readIfAvailable()
public com.yahoo.jdisc.handler.ContentChannel handleResponse(com.yahoo.jdisc.Response response)
handleResponse
in interface com.yahoo.jdisc.handler.ResponseHandler
public void clientClose()
public int getStatus()
public com.yahoo.jdisc.Response getResponse()
Copyright © 2017. All rights reserved.