Package org.robolectric.shadows
Class ShadowNetwork
java.lang.Object
org.robolectric.shadows.ShadowNetwork
-
Constructor Summary
Constructors -
Method Summary
Modifier 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.booleanChecks 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.
-
Constructor Details
-
ShadowNetwork
public ShadowNetwork()
-
-
Method Details
-
newInstance
Creates new instance ofNetwork, because its constructor is hidden.- Parameters:
netId- The netId.- Returns:
- The Network instance.
-
isSocketBound
Checks if thesocketwas previously bound to this network. -
isSocketBound
Checks if thedatagramSocketwas previously bound to this network. -
isSocketBound
Checks if thefileDescriptorwas previously bound to this network. -
boundSocketCount
public int boundSocketCount()Returns the total number of sockets bound to this network interface. -
bindSocket
Simulates 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. -
bindSocket
Simulates 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. -
bindSocket
Simulates 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. -
getNetId
Allows to get the stored netId.- Returns:
- The netId.
-