|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.net.URLConnection
java.net.HttpURLConnection
com.google.api.client.testing.http.javanet.MockHttpURLConnection
public class MockHttpURLConnection
Mock for HttpURLConnection
.
Implementation is not thread-safe.
Field Summary |
---|
Fields inherited from class java.net.URLConnection |
---|
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches |
Constructor Summary | |
---|---|
MockHttpURLConnection(URL u)
|
Method Summary | |
---|---|
void |
connect()
|
void |
disconnect()
|
boolean |
doOutputCalled()
Returns whether URLConnection.doOutput was called. |
OutputStream |
getOutputStream()
|
int |
getResponseCode()
|
void |
setDoOutput(boolean dooutput)
|
MockHttpURLConnection |
setOutputStream(OutputStream outputStream)
Sets the output stream or null to throw an UnknownServiceException when
getOutputStream() is called. |
MockHttpURLConnection |
setResponseCode(int responseCode)
Sets the HTTP response status code. |
boolean |
usingProxy()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MockHttpURLConnection(URL u)
u
- the URL or null
for noneMethod Detail |
---|
public void disconnect()
disconnect
in class HttpURLConnection
public boolean usingProxy()
usingProxy
in class HttpURLConnection
public void connect() throws IOException
connect
in class URLConnection
IOException
public int getResponseCode() throws IOException
getResponseCode
in class HttpURLConnection
IOException
public void setDoOutput(boolean dooutput)
setDoOutput
in class URLConnection
public OutputStream getOutputStream() throws IOException
getOutputStream
in class URLConnection
IOException
public final boolean doOutputCalled()
URLConnection.doOutput
was called.
public MockHttpURLConnection setOutputStream(OutputStream outputStream)
null
to throw an UnknownServiceException
when
getOutputStream()
is called.
By default it is null
.
public MockHttpURLConnection setResponseCode(int responseCode)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |