mockwebserver
Module Contents
alltypes
Module Contents
abstract
class
Dispatcher
Module Contents
Dispatcher
(
)
abstract
fun
dispatch
(
request
:
RecordedRequest
)
:
MockResponse
open
fun
peek
(
)
:
MockResponse
open
fun
shutdown
(
)
:
Unit
interface
DuplexResponseBody
Module Contents
abstract
fun
onRequest
(
request
:
RecordedRequest
,
requestBody
:
BufferedSource
,
responseBody
:
BufferedSink
)
:
Unit
class
MockDuplexResponseBody
:
DuplexResponseBody
Module Contents
MockDuplexResponseBody
(
)
fun
awaitSuccess
(
)
:
Unit
fun
exhaustRequest
(
)
:
MockDuplexResponseBody
fun
exhaustResponse
(
)
:
MockDuplexResponseBody
fun
onRequest
(
request
:
RecordedRequest
,
requestBody
:
BufferedSource
,
responseBody
:
BufferedSink
)
:
Unit
fun
receiveRequest
(
expected
:
String
)
:
MockDuplexResponseBody
fun
requestIOException
(
)
:
MockDuplexResponseBody
@JvmOverloads
fun
sendResponse
(
s
:
String
,
responseSent
:
CountDownLatch
=
CountDownLatch(0)
)
:
MockDuplexResponseBody
fun
sleep
(
duration
:
Long
,
unit
:
TimeUnit
)
:
MockDuplexResponseBody
class
MockResponse
:
Cloneable
Module Contents
MockResponse
(
)
fun
addHeader
(
header
:
String
)
:
MockResponse
fun
addHeader
(
name
:
String
,
value
:
Any
)
:
MockResponse
fun
addHeaderLenient
(
name
:
String
,
value
:
Any
)
:
MockResponse
fun
clearHeaders
(
)
:
MockResponse
fun
clone
(
)
:
MockResponse
var
duplexResponseBody
:
DuplexResponseBody
?
fun
getBody
(
)
:
Buffer
?
fun
getBodyDelay
(
unit
:
TimeUnit
)
:
Long
fun
getHeaders
(
)
:
Headers
fun
getHeadersDelay
(
unit
:
TimeUnit
)
:
Long
fun
getHttp2ErrorCode
(
)
:
Int
fun
getSocketPolicy
(
)
:
SocketPolicy
fun
getStatus
(
)
:
String
fun
getThrottlePeriod
(
unit
:
TimeUnit
)
:
Long
fun
getTrailers
(
)
:
Headers
val
isDuplex
:
Boolean
val
pushPromises
:
List
<
PushPromise
>
fun
removeHeader
(
name
:
String
)
:
MockResponse
fun
setBody
(
body
:
Buffer
)
:
MockResponse
fun
setBody
(
body
:
String
)
:
MockResponse
fun
setBody
(
duplexResponseBody
:
DuplexResponseBody
)
:
MockResponse
fun
setBodyDelay
(
delay
:
Long
,
unit
:
TimeUnit
)
:
MockResponse
fun
setChunkedBody
(
body
:
Buffer
,
maxChunkSize
:
Int
)
:
MockResponse
fun
setChunkedBody
(
body
:
String
,
maxChunkSize
:
Int
)
:
MockResponse
fun
setHeader
(
name
:
String
,
value
:
Any
)
:
MockResponse
fun
setHeaders
(
headers
:
Headers
)
:
MockResponse
fun
setHeadersDelay
(
delay
:
Long
,
unit
:
TimeUnit
)
:
MockResponse
fun
setHttp2ErrorCode
(
http2ErrorCode
:
Int
)
:
MockResponse
fun
setResponseCode
(
code
:
Int
)
:
MockResponse
fun
setSocketPolicy
(
socketPolicy
:
SocketPolicy
)
:
MockResponse
fun
setStatus
(
status
:
String
)
:
MockResponse
var
settings
:
Settings
fun
setTrailers
(
trailers
:
Headers
)
:
MockResponse
fun
throttleBody
(
bytesPerPeriod
:
Long
,
period
:
Long
,
unit
:
TimeUnit
)
:
MockResponse
var
throttleBytesPerPeriod
:
Long
fun
toString
(
)
:
String
var
webSocketListener
:
WebSocketListener
?
fun
withPush
(
promise
:
PushPromise
)
:
MockResponse
fun
withSettings
(
settings
:
Settings
)
:
MockResponse
fun
withWebSocketUpgrade
(
listener
:
WebSocketListener
)
:
MockResponse
class
MockWebServer
:
ExternalResource
,
Closeable
Module Contents
MockWebServer
(
)
@Synchronized
protected
fun
after
(
)
:
Unit
@Synchronized
protected
fun
before
(
)
:
Unit
fun
close
(
)
:
Unit
var
dispatcher
:
Dispatcher
fun
enqueue
(
response
:
MockResponse
)
:
Unit
fun
getPort
(
)
:
Int
fun
getRequestCount
(
)
:
Int
val
hostName
:
String
fun
noClientAuth
(
)
:
Unit
fun
protocols
(
)
:
List
<
Protocol
>
fun
requestClientAuth
(
)
:
Unit
fun
requireClientAuth
(
)
:
Unit
fun
setBodyLimit
(
maxBodyLength
:
Long
)
:
Unit
fun
setProtocolNegotiationEnabled
(
protocolNegotiationEnabled
:
Boolean
)
:
Unit
fun
setProtocols
(
protocols
:
List
<
Protocol
>
)
:
Unit
fun
setServerSocketFactory
(
serverSocketFactory
:
ServerSocketFactory
)
:
Unit
@Synchronized
fun
shutdown
(
)
:
Unit
inner
class
SocketHandler
Module Contents
SocketHandler
(
raw
:
Socket
)
fun
handle
(
)
:
Unit
@JvmOverloads
fun
start
(
port
:
Int
=
0
)
:
Unit
fun
start
(
inetAddress
:
InetAddress
,
port
:
Int
)
:
Unit
fun
takeRequest
(
)
:
RecordedRequest
fun
takeRequest
(
timeout
:
Long
,
unit
:
TimeUnit
)
:
RecordedRequest
?
fun
toProxyAddress
(
)
:
Proxy
fun
toString
(
)
:
String
fun
url
(
path
:
String
)
:
HttpUrl
fun
useHttps
(
sslSocketFactory
:
SSLSocketFactory
,
tunnelProxy
:
Boolean
)
:
Unit
class
PushPromise
Module Contents
PushPromise
(
method
:
String
,
path
:
String
,
headers
:
Headers
,
response
:
MockResponse
)
val
headers
:
Headers
val
method
:
String
val
path
:
String
val
response
:
MockResponse
open
class
QueueDispatcher
:
Dispatcher
Module Contents
QueueDispatcher
(
)
open
fun
dispatch
(
request
:
RecordedRequest
)
:
MockResponse
open
fun
enqueueResponse
(
response
:
MockResponse
)
:
Unit
open
fun
peek
(
)
:
MockResponse
protected
val
responseQueue
:
BlockingQueue
<
MockResponse
>
open
fun
setFailFast
(
failFast
:
Boolean
)
:
Unit
open
fun
setFailFast
(
failFastResponse
:
MockResponse
?
)
:
Unit
open
fun
shutdown
(
)
:
Unit
class
RecordedRequest
Module Contents
RecordedRequest
(
requestLine
:
String
,
headers
:
Headers
,
chunkSizes
:
List
<
Int
>
,
bodySize
:
Long
,
body
:
Buffer
,
sequenceNumber
:
Int
,
socket
:
Socket
)
val
body
:
Buffer
val
bodySize
:
Long
val
chunkSizes
:
List
<
Int
>
fun
getHeader
(
name
:
String
)
:
String
?
val
handshake
:
Handshake
?
val
headers
:
Headers
val
method
:
String
?
val
path
:
String
?
val
requestLine
:
String
val
requestUrl
:
HttpUrl
?
val
sequenceNumber
:
Int
val
tlsVersion
:
TlsVersion
?
fun
toString
(
)
:
String
val
utf8Body
:
String
enum
class
SocketPolicy
Module Contents
CONTINUE_ALWAYS
DISCONNECT_AFTER_REQUEST
DISCONNECT_AT_END
DISCONNECT_AT_START
DISCONNECT_DURING_REQUEST_BODY
DISCONNECT_DURING_RESPONSE_BODY
EXPECT_CONTINUE
FAIL_HANDSHAKE
KEEP_OPEN
NO_RESPONSE
RESET_STREAM_AT_START
SHUTDOWN_INPUT_AT_END
SHUTDOWN_OUTPUT_AT_END
SHUTDOWN_SERVER_AFTER_RESPONSE
STALL_SOCKET_AT_START
UPGRADE_TO_SSL_AT_END
package
okhttp3.mockwebserver
Module Contents
abstract
class
Dispatcher
Module Contents
Dispatcher
(
)
abstract
fun
dispatch
(
request
:
RecordedRequest
)
:
MockResponse
open
fun
peek
(
)
:
MockResponse
open
fun
shutdown
(
)
:
Unit
class
MockResponse
:
Cloneable
Module Contents
MockResponse
(
)
fun
addHeader
(
header
:
String
)
:
MockResponse
fun
addHeader
(
name
:
String
,
value
:
Any
)
:
MockResponse
fun
addHeaderLenient
(
name
:
String
,
value
:
Any
)
:
MockResponse
fun
clearHeaders
(
)
:
MockResponse
fun
clone
(
)
:
MockResponse
var
duplexResponseBody
:
DuplexResponseBody
?
fun
getBody
(
)
:
Buffer
?
fun
getBodyDelay
(
unit
:
TimeUnit
)
:
Long
fun
getHeaders
(
)
:
Headers
fun
getHeadersDelay
(
unit
:
TimeUnit
)
:
Long
fun
getHttp2ErrorCode
(
)
:
Int
fun
getSocketPolicy
(
)
:
SocketPolicy
fun
getStatus
(
)
:
String
fun
getThrottlePeriod
(
unit
:
TimeUnit
)
:
Long
fun
getTrailers
(
)
:
Headers
val
isDuplex
:
Boolean
val
pushPromises
:
List
<
PushPromise
>
fun
removeHeader
(
name
:
String
)
:
MockResponse
fun
setBody
(
body
:
Buffer
)
:
MockResponse
fun
setBody
(
body
:
String
)
:
MockResponse
fun
setBody
(
duplexResponseBody
:
DuplexResponseBody
)
:
MockResponse
fun
setBodyDelay
(
delay
:
Long
,
unit
:
TimeUnit
)
:
MockResponse
fun
setChunkedBody
(
body
:
Buffer
,
maxChunkSize
:
Int
)
:
MockResponse
fun
setChunkedBody
(
body
:
String
,
maxChunkSize
:
Int
)
:
MockResponse
fun
setHeader
(
name
:
String
,
value
:
Any
)
:
MockResponse
fun
setHeaders
(
headers
:
Headers
)
:
MockResponse
fun
setHeadersDelay
(
delay
:
Long
,
unit
:
TimeUnit
)
:
MockResponse
fun
setHttp2ErrorCode
(
http2ErrorCode
:
Int
)
:
MockResponse
fun
setResponseCode
(
code
:
Int
)
:
MockResponse
fun
setSocketPolicy
(
socketPolicy
:
SocketPolicy
)
:
MockResponse
fun
setStatus
(
status
:
String
)
:
MockResponse
var
settings
:
Settings
fun
setTrailers
(
trailers
:
Headers
)
:
MockResponse
fun
throttleBody
(
bytesPerPeriod
:
Long
,
period
:
Long
,
unit
:
TimeUnit
)
:
MockResponse
var
throttleBytesPerPeriod
:
Long
fun
toString
(
)
:
String
var
webSocketListener
:
WebSocketListener
?
fun
withPush
(
promise
:
PushPromise
)
:
MockResponse
fun
withSettings
(
settings
:
Settings
)
:
MockResponse
fun
withWebSocketUpgrade
(
listener
:
WebSocketListener
)
:
MockResponse
class
MockWebServer
:
ExternalResource
,
Closeable
Module Contents
MockWebServer
(
)
@Synchronized
protected
fun
after
(
)
:
Unit
@Synchronized
protected
fun
before
(
)
:
Unit
fun
close
(
)
:
Unit
var
dispatcher
:
Dispatcher
fun
enqueue
(
response
:
MockResponse
)
:
Unit
fun
getPort
(
)
:
Int
fun
getRequestCount
(
)
:
Int
val
hostName
:
String
fun
noClientAuth
(
)
:
Unit
fun
protocols
(
)
:
List
<
Protocol
>
fun
requestClientAuth
(
)
:
Unit
fun
requireClientAuth
(
)
:
Unit
fun
setBodyLimit
(
maxBodyLength
:
Long
)
:
Unit
fun
setProtocolNegotiationEnabled
(
protocolNegotiationEnabled
:
Boolean
)
:
Unit
fun
setProtocols
(
protocols
:
List
<
Protocol
>
)
:
Unit
fun
setServerSocketFactory
(
serverSocketFactory
:
ServerSocketFactory
)
:
Unit
@Synchronized
fun
shutdown
(
)
:
Unit
inner
class
SocketHandler
Module Contents
SocketHandler
(
raw
:
Socket
)
fun
handle
(
)
:
Unit
@JvmOverloads
fun
start
(
port
:
Int
=
0
)
:
Unit
fun
start
(
inetAddress
:
InetAddress
,
port
:
Int
)
:
Unit
fun
takeRequest
(
)
:
RecordedRequest
fun
takeRequest
(
timeout
:
Long
,
unit
:
TimeUnit
)
:
RecordedRequest
?
fun
toProxyAddress
(
)
:
Proxy
fun
toString
(
)
:
String
fun
url
(
path
:
String
)
:
HttpUrl
fun
useHttps
(
sslSocketFactory
:
SSLSocketFactory
,
tunnelProxy
:
Boolean
)
:
Unit
class
PushPromise
Module Contents
PushPromise
(
method
:
String
,
path
:
String
,
headers
:
Headers
,
response
:
MockResponse
)
val
headers
:
Headers
val
method
:
String
val
path
:
String
val
response
:
MockResponse
open
class
QueueDispatcher
:
Dispatcher
Module Contents
QueueDispatcher
(
)
open
fun
dispatch
(
request
:
RecordedRequest
)
:
MockResponse
open
fun
enqueueResponse
(
response
:
MockResponse
)
:
Unit
open
fun
peek
(
)
:
MockResponse
protected
val
responseQueue
:
BlockingQueue
<
MockResponse
>
open
fun
setFailFast
(
failFast
:
Boolean
)
:
Unit
open
fun
setFailFast
(
failFastResponse
:
MockResponse
?
)
:
Unit
open
fun
shutdown
(
)
:
Unit
class
RecordedRequest
Module Contents
RecordedRequest
(
requestLine
:
String
,
headers
:
Headers
,
chunkSizes
:
List
<
Int
>
,
bodySize
:
Long
,
body
:
Buffer
,
sequenceNumber
:
Int
,
socket
:
Socket
)
val
body
:
Buffer
val
bodySize
:
Long
val
chunkSizes
:
List
<
Int
>
fun
getHeader
(
name
:
String
)
:
String
?
val
handshake
:
Handshake
?
val
headers
:
Headers
val
method
:
String
?
val
path
:
String
?
val
requestLine
:
String
val
requestUrl
:
HttpUrl
?
val
sequenceNumber
:
Int
val
tlsVersion
:
TlsVersion
?
fun
toString
(
)
:
String
val
utf8Body
:
String
enum
class
SocketPolicy
Module Contents
CONTINUE_ALWAYS
DISCONNECT_AFTER_REQUEST
DISCONNECT_AT_END
DISCONNECT_AT_START
DISCONNECT_DURING_REQUEST_BODY
DISCONNECT_DURING_RESPONSE_BODY
EXPECT_CONTINUE
FAIL_HANDSHAKE
KEEP_OPEN
NO_RESPONSE
RESET_STREAM_AT_START
SHUTDOWN_INPUT_AT_END
SHUTDOWN_OUTPUT_AT_END
SHUTDOWN_SERVER_AFTER_RESPONSE
STALL_SOCKET_AT_START
UPGRADE_TO_SSL_AT_END
package
okhttp3.mockwebserver.internal.duplex
Module Contents
interface
DuplexResponseBody
Module Contents
abstract
fun
onRequest
(
request
:
RecordedRequest
,
requestBody
:
BufferedSource
,
responseBody
:
BufferedSink
)
:
Unit
class
MockDuplexResponseBody
:
DuplexResponseBody
Module Contents
MockDuplexResponseBody
(
)
fun
awaitSuccess
(
)
:
Unit
fun
exhaustRequest
(
)
:
MockDuplexResponseBody
fun
exhaustResponse
(
)
:
MockDuplexResponseBody
fun
onRequest
(
request
:
RecordedRequest
,
requestBody
:
BufferedSource
,
responseBody
:
BufferedSink
)
:
Unit
fun
receiveRequest
(
expected
:
String
)
:
MockDuplexResponseBody
fun
requestIOException
(
)
:
MockDuplexResponseBody
@JvmOverloads
fun
sendResponse
(
s
:
String
,
responseSent
:
CountDownLatch
=
CountDownLatch(0)
)
:
MockDuplexResponseBody
fun
sleep
(
duration
:
Long
,
unit
:
TimeUnit
)
:
MockDuplexResponseBody