org.fourthline.cling.mock
Class MockUpnpService.MockRouter

java.lang.Object
  extended by org.fourthline.cling.mock.MockUpnpService.MockRouter
All Implemented Interfaces:
Router
Enclosing class:
MockUpnpService

public class MockUpnpService.MockRouter
extends Object
implements Router


Constructor Summary
MockUpnpService.MockRouter()
           
 
Method Summary
 void broadcast(byte[] bytes)
           Call this method to broadcast a UDP message to all hosts on the network.
 List<NetworkAddress> getActiveStreamServers(InetAddress preferredAddress)
           
 UpnpServiceConfiguration getConfiguration()
           
 NetworkAddressFactory getNetworkAddressFactory()
           
 ProtocolFactory getProtocolFactory()
           
 StreamClient getStreamClient()
           
 void received(IncomingDatagramMessage msg)
           This method is called internally by the transport layer when a datagram, either unicast or multicast, has been received.
 void received(UpnpStream stream)
           This method is called internally by the transport layer when a TCP stream connection has been made and a response has to be returned to the sender.
 void send(OutgoingDatagramMessage msg)
           Call this method to send a UDP datagram message.
 StreamResponseMessage send(StreamRequestMessage msg)
           Call this method to send a TCP (HTTP) stream message.
 void shutdown()
          Unbinds all sockets and stops all listening threads for datagrams and streams.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockUpnpService.MockRouter

public MockUpnpService.MockRouter()
Method Detail

getConfiguration

public UpnpServiceConfiguration getConfiguration()
Specified by:
getConfiguration in interface Router
Returns:
The configuration used by this router.

getProtocolFactory

public ProtocolFactory getProtocolFactory()
Specified by:
getProtocolFactory in interface Router
Returns:
The protocol factory used by this router.

getStreamClient

public StreamClient getStreamClient()

getNetworkAddressFactory

public NetworkAddressFactory getNetworkAddressFactory()
Specified by:
getNetworkAddressFactory in interface Router
Returns:
The network interface and address binding configuration of this router.

getActiveStreamServers

public List<NetworkAddress> getActiveStreamServers(InetAddress preferredAddress)
Specified by:
getActiveStreamServers in interface Router
Parameters:
preferredAddress - A preferred stream server bound address or null.
Returns:
An empty list if no stream server is currently active, otherwise a single network address if the preferred address is active, or a list of all active bound stream servers.

shutdown

public void shutdown()
Description copied from interface: Router
Unbinds all sockets and stops all listening threads for datagrams and streams.

Specified by:
shutdown in interface Router

received

public void received(IncomingDatagramMessage msg)
Description copied from interface: Router

This method is called internally by the transport layer when a datagram, either unicast or multicast, has been received. An implementation of this interface has to handle the received message, e.g. selecting and executing a UPnP protocol. This method should not block until the execution completes, the calling thread should be free to handle the next reception as soon as possible.

Specified by:
received in interface Router
Parameters:
msg - The received datagram message.

received

public void received(UpnpStream stream)
Description copied from interface: Router

This method is called internally by the transport layer when a TCP stream connection has been made and a response has to be returned to the sender. An implementation of this interface has to handle the received stream connection and return a response, e.g. selecting and executing a UPnP protocol. This method should not block until the execution completes, the calling thread should be free to process the next reception as soon as possible. Typically this means starting a new thread of execution in this method.

Specified by:
received in interface Router

send

public void send(OutgoingDatagramMessage msg)
Description copied from interface: Router

Call this method to send a UDP datagram message.

Specified by:
send in interface Router
Parameters:
msg - The UDP datagram message to send.

send

public StreamResponseMessage send(StreamRequestMessage msg)
Description copied from interface: Router

Call this method to send a TCP (HTTP) stream message.

Specified by:
send in interface Router
Parameters:
msg - The TCP (HTTP) stream message to send.
Returns:
The response received from the server.

broadcast

public void broadcast(byte[] bytes)
Description copied from interface: Router

Call this method to broadcast a UDP message to all hosts on the network.

Specified by:
broadcast in interface Router
Parameters:
bytes - The byte payload of the UDP datagram.


Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.