Package org.robolectric.shadows
Class ShadowNetwork
java.lang.Object
org.robolectric.shadows.ShadowNetwork
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidSimulates a socket bind.protected voidbindSocket(DatagramSocket socket) Simulates a socket bind.protected voidbindSocket(Socket socket) Simulates a socket bind.intReturns the total number of sockets bound to this network interface.intgetNetId()Allows to get the stored netId.protected SocketFactorybooleanChecks if thefileDescriptorwas previously bound to this network.booleanisSocketBound(DatagramSocket socket) Checks if thedatagramSocketwas previously bound to this network.booleanisSocketBound(Socket socket) Checks if thesocketwas previously bound to this network.static NetworknewInstance(int netId) Creates new instance ofNetwork, because its constructor is hidden.voidsetSocketFactory(SocketFactory socketFactory) Sets the socket factory to be provided bygetSocketFactory()
- 
Constructor Details- 
ShadowNetworkpublic ShadowNetwork()
 
- 
- 
Method Details- 
newInstanceCreates new instance ofNetwork, because its constructor is hidden.- Parameters:
- netId- The netId.
- Returns:
- The Network instance.
 
- 
isSocketBoundChecks if thesocketwas previously bound to this network.
- 
isSocketBoundChecks if thedatagramSocketwas previously bound to this network.
- 
isSocketBoundChecks if thefileDescriptorwas previously bound to this network.
- 
boundSocketCountpublic int boundSocketCount()Returns the total number of sockets bound to this network interface.
- 
bindSocketSimulates a socket bind. isSocketBound can be called to verify that the socket was bound to this network interface, and boundSocketCount() will increment for any unique socket.
- 
bindSocketSimulates a socket bind. isSocketBound can be called to verify that the socket was bound to this network interface, and boundSocketCount() will increment for any unique socket.
- 
bindSocketSimulates a socket bind. isSocketBound can be called to verify that the fd was bound to this network interface, and boundSocketCount() will increment for any unique socket.
- 
getNetIdAllows to get the stored netId.- Returns:
- The netId.
 
- 
setSocketFactorySets the socket factory to be provided bygetSocketFactory()
- 
getSocketFactory
 
-