@Implements(value=android.net.Network.class, minSdk=21) public class ShadowNetwork extends Object
Constructor | Description |
---|---|
ShadowNetwork() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
bindSocket(FileDescriptor fd) |
Simulates a socket bind.
|
protected void |
bindSocket(DatagramSocket socket) |
Simulates a socket bind.
|
protected void |
bindSocket(Socket socket) |
Simulates a socket bind.
|
int |
boundSocketCount() |
Returns the total number of sockets bound to this network interface.
|
int |
getNetId() |
Allows to get the stored netId.
|
boolean |
isSocketBound(FileDescriptor fd) |
Checks if the
fileDescriptor was previously bound to this network. |
boolean |
isSocketBound(DatagramSocket socket) |
Checks if the
datagramSocket was previously bound to this network. |
boolean |
isSocketBound(Socket socket) |
Checks if the
socket was previously bound to this network. |
static Network |
newInstance(int netId) |
Creates new instance of
Network , because its constructor is hidden. |
public static Network newInstance(int netId)
Network
, because its constructor is hidden.netId
- The netId.public boolean isSocketBound(Socket socket)
socket
was previously bound to this network.public boolean isSocketBound(DatagramSocket socket)
datagramSocket
was previously bound to this network.public boolean isSocketBound(FileDescriptor fd)
fileDescriptor
was previously bound to this network.public int boundSocketCount()
@Implementation(minSdk=22) protected void bindSocket(DatagramSocket socket)
@Implementation protected void bindSocket(Socket socket)
@Implementation(minSdk=23) protected void bindSocket(FileDescriptor fd)
public int getNetId()