Adds basic support for StunHarvester-s to the ICE candidate gathering operations

This commit is contained in:
emcho 2010-02-15 22:16:28 +00:00
parent 627097b986
commit 143229ad06
3 changed files with 36 additions and 10 deletions

View File

@ -316,12 +316,14 @@ public class MessageEventDispatchingTest extends TestCase
* determined to be unreachable and that the request should be * determined to be unreachable and that the request should be
* considered unanswered. * considered unanswered.
* *
* @param exception the <tt>PortUnreachableException</tt> which signaled * @param event the <tt>StunFailureEvent</tt>
* that the destination of the request was found to be unreachable * <tt>PortUnreachableException</tt> which signaled that the destination
* @see ResponseCollector#processUnreachable(PortUnreachableException) * of the request was found to be unreachable
*
* @see ResponseCollector#processUnreachable(StunFailureEvent)
*/ */
public synchronized void processUnreachable( public synchronized void processUnreachable(
PortUnreachableException exception) StunFailureEvent event)
{ {
receivedResponses.add("unreachable"); receivedResponses.add("unreachable");
notifyAll(); notifyAll();

View File

@ -550,11 +550,13 @@ public class TransactionSupportTests extends TestCase
* determined to be unreachable and that the request should be * determined to be unreachable and that the request should be
* considered unanswered. * considered unanswered.
* *
* @param exception the <tt>PortUnreachableException</tt> which signaled * @param event the <tt>StunFailureEvent</tt> containing
* <tt>PortUnreachableException</tt> which signaled
* that the destination of the request was found to be unreachable * that the destination of the request was found to be unreachable
* @see ResponseCollector#processUnreachable(PortUnreachableException) *
* @see ResponseCollector#processUnreachable(StunFailureEvent)
*/ */
public void processUnreachable(PortUnreachableException exception) public void processUnreachable(StunFailureEvent event)
{ {
receivedResponses.add("unreachable"); receivedResponses.add("unreachable");
} }

View File

@ -40,11 +40,21 @@ public class ShallowStackTest extends TestCase {
private DatagramPacket bindingRequestPacket private DatagramPacket bindingRequestPacket
= new DatagramPacket(new byte[4096], 4096); = new DatagramPacket(new byte[4096], 4096);
/**
* Creates a test instance for the method with the specified name.
*
* @param name the name of the test we'd like to create an instance for.
*/
public ShallowStackTest(String name) public ShallowStackTest(String name)
{ {
super(name); super(name);
} }
/**
* Initializes whatever sockets we'll be using in our tests.
*
* @throws Exception if something goes wrong with socket initialization.
*/
protected void setUp() protected void setUp()
throws Exception throws Exception
{ {
@ -68,6 +78,11 @@ public class ShallowStackTest extends TestCase {
dummyServerSocket = new DatagramSocket( dummyServerAddress ); dummyServerSocket = new DatagramSocket( dummyServerAddress );
} }
/**
* Releases the sockets we use here.
*
* @throws Exception if closing the sockets fails.
*/
protected void tearDown() protected void tearDown()
throws Exception throws Exception
{ {
@ -234,6 +249,11 @@ public class ShallowStackTest extends TestCase {
receivedResponse); // actual receivedResponse); // actual
} }
/**
* Performs a basic test on message reception
*
* @throws Exception if something fails somewhere.
*/
public void testReceiveResponse() public void testReceiveResponse()
throws Exception throws Exception
{ {
@ -318,12 +338,14 @@ public class ShallowStackTest extends TestCase {
* determined to be unreachable and that the request should be * determined to be unreachable and that the request should be
* considered unanswered. * considered unanswered.
* *
* @param exception the <tt>PortUnreachableException</tt> which signaled * @param evt the <tt>StunFailureEvent</tt> containing the
* <tt>PortUnreachableException</tt> which signaled
* that the destination of the request was found to be unreachable * that the destination of the request was found to be unreachable
* @see ResponseCollector#processUnreachable(PortUnreachableException) *
* @see ResponseCollector#processUnreachable(StunFailureEvent)
*/ */
public synchronized void processUnreachable( public synchronized void processUnreachable(
PortUnreachableException exception) StunFailureEvent evt)
{ {
logger.info("Unreachable"); logger.info("Unreachable");
notifyAll(); notifyAll();