Makes TransportAddress a descendant of InetSocketAddress.
This commit is contained in:
parent
30ae0a9047
commit
cb3228446f
@ -1,49 +1,102 @@
|
||||
/*
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j;
|
||||
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.message.*;
|
||||
import org.ice4j.stack.*;
|
||||
|
||||
/**
|
||||
* Test event dispatching for both client and server.
|
||||
* <p>Company: Net Research Team, Louis Pasteur University</p>
|
||||
*`
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public class MessageEventDispatchingTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* The stack that we are using for the tests.
|
||||
*/
|
||||
StunStack stunStack = null;
|
||||
|
||||
TransportAddress clientAddress = new TransportAddress("127.0.0.1", 5216);
|
||||
TransportAddress serverAddress = new TransportAddress("127.0.0.2", 5255);
|
||||
TransportAddress serverAddress2 = new TransportAddress("127.0.0.2", 5259);
|
||||
/**
|
||||
* The address of the client.
|
||||
*/
|
||||
TransportAddress clientAddress
|
||||
= new TransportAddress("127.0.0.1", 5216, Transport.UDP);
|
||||
|
||||
NetAccessPointDescriptor clientAccessPoint = null;
|
||||
NetAccessPointDescriptor serverAccessPoint = null;
|
||||
NetAccessPointDescriptor serverAccessPoint2 = null;
|
||||
/**
|
||||
* The Address of the server.
|
||||
*/
|
||||
TransportAddress serverAddress
|
||||
= new TransportAddress("127.0.0.2", 5255, Transport.UDP);
|
||||
|
||||
/**
|
||||
* The address of the second server.
|
||||
*/
|
||||
TransportAddress serverAddress2
|
||||
= new TransportAddress("127.0.0.2", 5259, Transport.UDP);
|
||||
|
||||
/**
|
||||
* The socket that the client is using.
|
||||
*/
|
||||
DatagramSocket clientSock = null;
|
||||
|
||||
/**
|
||||
* The socket that the server is using
|
||||
*/
|
||||
DatagramSocket serverSock = null;
|
||||
|
||||
/**
|
||||
* The second server socket.
|
||||
*/
|
||||
DatagramSocket serverSock2 = null;
|
||||
|
||||
/**
|
||||
* The request that we will be sending in this test.
|
||||
*/
|
||||
Request bindingRequest = null;
|
||||
|
||||
/**
|
||||
* The response that we will be sending in response to the above request.
|
||||
*/
|
||||
Response bindingResponse = null;
|
||||
|
||||
/**
|
||||
* The request collector that we use to wait for requests.
|
||||
*/
|
||||
PlainRequestCollector requestCollector = null;
|
||||
|
||||
/**
|
||||
* The responses collector that we use to wait for responses.
|
||||
*/
|
||||
PlainResponseCollector responseCollector = null;
|
||||
|
||||
/**
|
||||
* junit setup method.
|
||||
*
|
||||
* @throws Exception if anything goes wrong.
|
||||
*/
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
stunStack = StunStack.getInstance();
|
||||
|
||||
clientAccessPoint = new NetAccessPointDescriptor(clientAddress);
|
||||
serverAccessPoint = new NetAccessPointDescriptor(serverAddress);
|
||||
serverAccessPoint2 = new NetAccessPointDescriptor(serverAddress2);
|
||||
clientSock = new DatagramSocket(clientAddress);
|
||||
serverSock = new DatagramSocket(clientAddress);
|
||||
serverSock = new DatagramSocket(serverAddress2);
|
||||
|
||||
stunStack.installNetAccessPoint(clientAccessPoint);
|
||||
stunStack.installNetAccessPoint(serverAccessPoint);
|
||||
stunStack.installNetAccessPoint(serverAccessPoint2);
|
||||
stunStack.installNetAccessPoint(clientSock);
|
||||
stunStack.installNetAccessPoint(serverSock);
|
||||
stunStack.installNetAccessPoint(serverSock2);
|
||||
|
||||
bindingRequest = MessageFactory.createBindingRequest();
|
||||
bindingResponse = MessageFactory.createBindingResponse(
|
||||
@ -54,10 +107,17 @@ public class MessageEventDispatchingTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* junit tear down method.
|
||||
*
|
||||
* @throws Exception if anything goes wrong.
|
||||
*/
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
clientAccessPoint = null;
|
||||
serverAccessPoint = null;
|
||||
clientSock.close();
|
||||
serverSock.close();
|
||||
serverSock.close();
|
||||
|
||||
requestCollector = null;
|
||||
responseCollector = null;
|
||||
|
||||
@ -74,9 +134,9 @@ public class MessageEventDispatchingTest extends TestCase
|
||||
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
clientAddress,
|
||||
responseCollector);
|
||||
Thread.currentThread().sleep(12000);
|
||||
Thread.sleep(12000);
|
||||
|
||||
assertEquals(
|
||||
"No timeout was produced upon expiration of a client transaction",
|
||||
@ -99,10 +159,10 @@ public class MessageEventDispatchingTest extends TestCase
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
clientAddress,
|
||||
responseCollector);
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(500);
|
||||
Thread.sleep(50);
|
||||
|
||||
//verify
|
||||
assertTrue("No MessageEvents have been dispatched",
|
||||
@ -119,20 +179,20 @@ public class MessageEventDispatchingTest extends TestCase
|
||||
throws Exception
|
||||
{
|
||||
//prepare to listen
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
stunStack.getProvider().addRequestListener(serverAddress,
|
||||
requestCollector);
|
||||
|
||||
PlainRequestCollector requestCollector2 = new PlainRequestCollector();
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint2,
|
||||
stunStack.getProvider().addRequestListener(serverAddress2,
|
||||
requestCollector2);
|
||||
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress2,
|
||||
clientAccessPoint,
|
||||
clientAddress,
|
||||
responseCollector);
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(500);
|
||||
Thread.sleep(50);
|
||||
|
||||
//verify
|
||||
assertTrue(
|
||||
@ -151,26 +211,26 @@ public class MessageEventDispatchingTest extends TestCase
|
||||
public void testServerResponseRetransmissions() throws Exception
|
||||
{
|
||||
//prepare to listen
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
stunStack.getProvider().addRequestListener(serverAddress,
|
||||
requestCollector);
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
clientAddress,
|
||||
responseCollector);
|
||||
|
||||
//wait for the message to arrive
|
||||
Thread.currentThread().sleep(500);
|
||||
Thread.sleep(50);
|
||||
|
||||
StunMessageEvent evt = requestCollector.receivedRequests.get(0);
|
||||
byte[] tid = evt.getMessage().getTransactionID();
|
||||
stunStack.getProvider().sendResponse(tid,
|
||||
bindingResponse,
|
||||
serverAccessPoint,
|
||||
serverAddress,
|
||||
clientAddress);
|
||||
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(500);
|
||||
Thread.sleep(50);
|
||||
|
||||
//verify that we got the response.
|
||||
assertTrue(
|
||||
@ -178,23 +238,49 @@ public class MessageEventDispatchingTest extends TestCase
|
||||
responseCollector.receivedResponses.size() == 1 );
|
||||
}
|
||||
|
||||
private class PlainRequestCollector implements RequestListener{
|
||||
public Vector<StunMessageEvent> receivedRequests = new Vector<StunMessageEvent>();
|
||||
/**
|
||||
* A utility class we use to collect incoming requests.
|
||||
*/
|
||||
private class PlainRequestCollector implements RequestListener
|
||||
{
|
||||
/** all requests we've received so far. */
|
||||
public Vector<StunMessageEvent> receivedRequests
|
||||
= new Vector<StunMessageEvent>();
|
||||
|
||||
public void requestReceived(StunMessageEvent evt){
|
||||
/**
|
||||
* Stores incoming requests.
|
||||
*
|
||||
* @param evt the event containing the incoming request.
|
||||
*/
|
||||
public void requestReceived(StunMessageEvent evt)
|
||||
{
|
||||
receivedRequests.add(evt);
|
||||
}
|
||||
}
|
||||
|
||||
private class PlainResponseCollector implements ResponseCollector{
|
||||
|
||||
/**
|
||||
* A utility class we use to collect incoming responses.
|
||||
*/
|
||||
private class PlainResponseCollector implements ResponseCollector
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Vector<Object> receivedResponses = new Vector<Object>();
|
||||
|
||||
/**
|
||||
* Stores incoming requests.
|
||||
*
|
||||
* @param responseEvt the event containing the incoming request.
|
||||
*/
|
||||
public void processResponse(StunMessageEvent responseEvt)
|
||||
{
|
||||
receivedResponses.add(responseEvt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that no response has been received.
|
||||
*/
|
||||
public void processTimeout()
|
||||
{
|
||||
receivedResponses.add(new String("timeout"));
|
||||
|
||||
@ -1,10 +1,16 @@
|
||||
/*
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j;
|
||||
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.message.*;
|
||||
import org.ice4j.stack.*;
|
||||
|
||||
@ -12,20 +18,41 @@ import org.ice4j.stack.*;
|
||||
* Test how client and server behave, how they recognize/adopt messages and
|
||||
* how they both handle retransmissions (i.e. client transactions should make
|
||||
* them and server transactions should hide them)
|
||||
* <p>Company: Net Research Team, Louis Pasteur University</p>
|
||||
*
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public class TransactionSupportTests extends TestCase
|
||||
{
|
||||
StunStack stunStack = null;
|
||||
/**
|
||||
* The client address we use for this test.
|
||||
*/
|
||||
TransportAddress clientAddress
|
||||
= new TransportAddress("127.0.0.1", 5216, Transport.UDP);
|
||||
|
||||
TransportAddress clientAddress = new TransportAddress("127.0.0.1", 5216);
|
||||
TransportAddress serverAddress = new TransportAddress("127.0.0.2", 5255);
|
||||
/**
|
||||
* The client address we use for this test.
|
||||
*/
|
||||
TransportAddress serverAddress
|
||||
= new TransportAddress("127.0.0.2", 5255, Transport.UDP);
|
||||
|
||||
NetAccessPointDescriptor clientAccessPoint = null;
|
||||
NetAccessPointDescriptor serverAccessPoint = null;
|
||||
/**
|
||||
* The socket the client uses in this test.
|
||||
*/
|
||||
DatagramSocket clientSock = null;
|
||||
|
||||
/**
|
||||
* The socket the server uses in this test.
|
||||
*/
|
||||
DatagramSocket serverSock = null;
|
||||
|
||||
/**
|
||||
* The request we send in this test.
|
||||
*/
|
||||
Request bindingRequest = null;
|
||||
|
||||
/**
|
||||
* The response we send in this test.
|
||||
*/
|
||||
Response bindingResponse = null;
|
||||
|
||||
PlainRequestCollector requestCollector = null;
|
||||
@ -35,13 +62,11 @@ public class TransactionSupportTests extends TestCase
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
stunStack = StunStack.getInstance();
|
||||
clientSock = new DatagramSocket(clientAddress);
|
||||
serverSock = new DatagramSocket(serverAddress);
|
||||
|
||||
clientAccessPoint = new NetAccessPointDescriptor(clientAddress);
|
||||
serverAccessPoint = new NetAccessPointDescriptor(serverAddress);
|
||||
|
||||
stunStack.installNetAccessPoint(clientAccessPoint);
|
||||
stunStack.installNetAccessPoint(serverAccessPoint);
|
||||
StunStack.getInstance().installNetAccessPoint(clientSock);
|
||||
StunStack.getInstance().installNetAccessPoint(serverSock);
|
||||
|
||||
bindingRequest = MessageFactory.createBindingRequest();
|
||||
bindingResponse = MessageFactory.createBindingResponse(
|
||||
@ -66,8 +91,9 @@ public class TransactionSupportTests extends TestCase
|
||||
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
clientAccessPoint = null;
|
||||
serverAccessPoint = null;
|
||||
clientSock.close();
|
||||
serverSock.close();
|
||||
|
||||
requestCollector = null;
|
||||
responseCollector = null;
|
||||
|
||||
@ -95,18 +121,19 @@ public class TransactionSupportTests extends TestCase
|
||||
//prepare to listen
|
||||
System.setProperty("org.ice4j.PROPAGATE_RECEIVED_RETRANSMISSIONS",
|
||||
"true");
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
requestCollector);
|
||||
|
||||
StunStack.getInstance().getProvider()
|
||||
.addRequestListener(serverAddress, requestCollector);
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
responseCollector);
|
||||
StunStack.getInstance().getProvider().sendRequest(bindingRequest,
|
||||
serverAddress, clientAddress, responseCollector);
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(12000);
|
||||
Thread.sleep(12000);
|
||||
|
||||
//verify
|
||||
Vector<StunMessageEvent> reqs = requestCollector.getRequestsForTransaction(bindingRequest.getTransactionID());
|
||||
Vector<StunMessageEvent> reqs
|
||||
= requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
assertTrue("No retransmissions of the request have been received",
|
||||
reqs.size() > 1);
|
||||
assertTrue("The binding request has not been retransmitted enough!",
|
||||
@ -122,28 +149,30 @@ public class TransactionSupportTests extends TestCase
|
||||
public void testServerRetransmissionHiding() throws Exception
|
||||
{
|
||||
//prepare to listen
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
requestCollector);
|
||||
StunStack.getInstance().getProvider().addRequestListener(
|
||||
serverAddress, requestCollector);
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
responseCollector);
|
||||
StunStack.getInstance().getProvider().sendRequest(bindingRequest,
|
||||
serverAddress, clientAddress, responseCollector);
|
||||
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(12000);
|
||||
Thread.sleep(12000);
|
||||
|
||||
//verify
|
||||
Vector reqs = requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
Vector<StunMessageEvent> reqs
|
||||
= requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
|
||||
assertTrue(
|
||||
"Retransmissions of a binding request were propagated to the server",
|
||||
reqs.size() <= 1 );
|
||||
"Retransmissions of a binding request were propagated "
|
||||
+ "to the server", reqs.size() <= 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure that once a request has been answered by the server,
|
||||
* retransmissions of this request are not propagated to the UA and are
|
||||
* automatically handled with a retransmission of the last seen response
|
||||
*
|
||||
* @throws Exception if we screw up.
|
||||
*/
|
||||
public void testServerResponseRetransmissions() throws Exception
|
||||
@ -151,26 +180,24 @@ public class TransactionSupportTests extends TestCase
|
||||
//prepare to listen
|
||||
System.setProperty("org.ice4j.KEEP_CLIENT_TRANS_AFTER_A_RESPONSE",
|
||||
"true");
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
requestCollector);
|
||||
StunStack.getInstance().getProvider().addRequestListener(
|
||||
serverAddress, requestCollector);
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
responseCollector);
|
||||
StunStack.getInstance().getProvider().sendRequest(
|
||||
bindingRequest, serverAddress,
|
||||
clientAddress, responseCollector);
|
||||
|
||||
//wait for the message to arrive
|
||||
Thread.currentThread().sleep(500);
|
||||
Thread.sleep(500);
|
||||
|
||||
Vector<StunMessageEvent> reqs = requestCollector
|
||||
.getRequestsForTransaction( bindingRequest.getTransactionID());
|
||||
|
||||
StunMessageEvent evt = ((StunMessageEvent)reqs.get(0));
|
||||
|
||||
Vector reqs = requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
StunMessageEvent evt =
|
||||
((StunMessageEvent)reqs.get(0));
|
||||
byte[] tid = evt.getMessage().getTransactionID();
|
||||
stunStack.getProvider().sendResponse(tid,
|
||||
bindingResponse,
|
||||
serverAccessPoint,
|
||||
clientAddress);
|
||||
StunStack.getInstance().getProvider().sendResponse(
|
||||
tid, bindingResponse, serverAddress, clientAddress);
|
||||
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(12000);
|
||||
@ -187,38 +214,35 @@ public class TransactionSupportTests extends TestCase
|
||||
*/
|
||||
public void testUniqueIDs() throws Exception
|
||||
{
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
requestCollector);
|
||||
StunStack.getInstance().getProvider().addRequestListener(
|
||||
serverAddress, requestCollector);
|
||||
//send req 1
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
responseCollector);
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(500);
|
||||
StunStack.getInstance().getProvider().sendRequest(bindingRequest,
|
||||
serverAddress, clientAddress, responseCollector);
|
||||
|
||||
Vector reqs1 = requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
StunMessageEvent evt1 =
|
||||
((StunMessageEvent)reqs1.get(0));
|
||||
//wait for retransmissions
|
||||
Thread.sleep(500);
|
||||
|
||||
Vector<StunMessageEvent> reqs1 = requestCollector
|
||||
.getRequestsForTransaction( bindingRequest.getTransactionID());
|
||||
|
||||
StunMessageEvent evt1 = ((StunMessageEvent)reqs1.get(0));
|
||||
|
||||
//send a response to make the other guy shut up
|
||||
byte[] tid = evt1.getMessage().getTransactionID();
|
||||
stunStack.getProvider().sendResponse(tid,
|
||||
bindingResponse,
|
||||
serverAccessPoint,
|
||||
clientAddress);
|
||||
StunStack.getInstance().getProvider().sendResponse(tid,
|
||||
bindingResponse, serverAddress, clientAddress);
|
||||
|
||||
//send req 2
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
responseCollector);
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(12000);
|
||||
StunStack.getInstance().getProvider().sendRequest(bindingRequest,
|
||||
serverAddress, clientAddress, responseCollector);
|
||||
|
||||
Vector reqs2 = requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
//wait for retransmissions
|
||||
Thread.sleep(12000);
|
||||
|
||||
Vector<StunMessageEvent> reqs2
|
||||
= requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
|
||||
StunMessageEvent evt2 = ((StunMessageEvent)reqs2.get(0));
|
||||
|
||||
@ -237,19 +261,19 @@ public class TransactionSupportTests extends TestCase
|
||||
//make sure we see retransmissions so that we may count them
|
||||
System.setProperty("org.ice4j.PROPAGATE_RECEIVED_RETRANSMISSIONS",
|
||||
"true");
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
requestCollector);
|
||||
StunStack.getInstance().getProvider().addRequestListener(
|
||||
serverAddress, requestCollector);
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
responseCollector);
|
||||
StunStack.getInstance().getProvider().sendRequest(
|
||||
bindingRequest, serverAddress, clientAddress, responseCollector);
|
||||
//wait for retransmissions
|
||||
Thread.currentThread().sleep(1600);
|
||||
Thread.sleep(1600);
|
||||
|
||||
//verify
|
||||
Vector reqs = requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
Vector<StunMessageEvent> reqs
|
||||
= requestCollector.getRequestsForTransaction(
|
||||
bindingRequest.getTransactionID());
|
||||
|
||||
assertTrue("No retransmissions of the request have been received",
|
||||
reqs.size() > 1);
|
||||
assertEquals(
|
||||
@ -268,13 +292,11 @@ public class TransactionSupportTests extends TestCase
|
||||
//make sure we see retransmissions so that we may count them
|
||||
System.setProperty("org.ice4j.PROPAGATE_RECEIVED_RETRANSMISSIONS",
|
||||
"true");
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
requestCollector);
|
||||
StunStack.getInstance().getProvider().addRequestListener(
|
||||
serverAddress, requestCollector);
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
responseCollector);
|
||||
StunStack.getInstance().getProvider().sendRequest(bindingRequest,
|
||||
serverAddress, clientAddress, responseCollector);
|
||||
|
||||
//wait a while
|
||||
Thread.currentThread().sleep(500);
|
||||
@ -308,15 +330,14 @@ public class TransactionSupportTests extends TestCase
|
||||
"true");
|
||||
System.setProperty("org.ice4j.MAX_RETRANSMISSIONS",
|
||||
"11");
|
||||
stunStack.getProvider().addRequestListener(serverAccessPoint,
|
||||
requestCollector);
|
||||
StunStack.getInstance().getProvider()
|
||||
.addRequestListener(serverAddress, requestCollector);
|
||||
//send
|
||||
stunStack.getProvider().sendRequest(bindingRequest,
|
||||
serverAddress,
|
||||
clientAccessPoint,
|
||||
responseCollector);
|
||||
// //wait a while
|
||||
Thread.currentThread().sleep(1095);
|
||||
StunStack.getInstance().getProvider().sendRequest(bindingRequest,
|
||||
serverAddress, clientAddress, responseCollector);
|
||||
|
||||
//wait a while
|
||||
Thread.sleep(1095);
|
||||
|
||||
//verify
|
||||
Vector reqs = requestCollector.getRequestsForTransaction(
|
||||
|
||||
@ -1,17 +1,16 @@
|
||||
/*
|
||||
* Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j.attribute;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.attribute.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -211,13 +210,13 @@ public class AddressAttributeTest extends TestCase {
|
||||
{
|
||||
XorMappedAddressAttribute addressAttribute = new XorMappedAddressAttribute();
|
||||
TransportAddress testAddress =
|
||||
new TransportAddress("130.79.95.53", 12120);
|
||||
new TransportAddress("130.79.95.53", 12120, Transport.UDP);
|
||||
|
||||
addressAttribute.setAddress(testAddress);
|
||||
|
||||
//do a xor with an id equal to the v4 address itself so that we get 0000..,
|
||||
TransportAddress xorredAddr =
|
||||
addressAttribute.applyXor(new byte[]{(byte)130,79,95,53,0,0,0,0,0,0,0,0,0,0,0,0,0});
|
||||
TransportAddress xorredAddr = addressAttribute.applyXor(
|
||||
new byte[]{(byte)130,79,95,53,0,0,0,0,0,0,0,0,0,0,0,0,0});
|
||||
|
||||
assertTrue("Xorring the address with itself didn't return 00000...",
|
||||
Arrays.equals(xorredAddr.getAddressBytes(), new byte[]{0,0,0,0}));
|
||||
@ -227,28 +226,28 @@ public class AddressAttributeTest extends TestCase {
|
||||
|
||||
//Test xor-ing the original with the xored - should get the xor code
|
||||
addressAttribute.setAddress(testAddress);
|
||||
xorredAddr =
|
||||
addressAttribute.applyXor(new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
xorredAddr = addressAttribute.applyXor(
|
||||
new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
|
||||
xorredAddr =
|
||||
addressAttribute.applyXor(xorredAddr.getAddressBytes());
|
||||
|
||||
assertTrue("Xorring the original with the xor-ed didn't return the code..",
|
||||
Arrays.equals(
|
||||
xorredAddr.getAddressBytes(),
|
||||
new byte[]{21,22,23,24}));
|
||||
assertTrue("Xorring the original with the xor-ed didn't "
|
||||
+"return the code..",
|
||||
Arrays.equals( xorredAddr.getAddressBytes(),
|
||||
new byte[]{21,22,23,24}));
|
||||
|
||||
assertTrue("Port was not xorred",
|
||||
testAddress.getPort() != 0xFFFF);
|
||||
|
||||
//Test double xor-ing - should get the original
|
||||
addressAttribute.setAddress(testAddress);
|
||||
xorredAddr =
|
||||
addressAttribute.applyXor(new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
xorredAddr = addressAttribute.applyXor(
|
||||
new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
|
||||
addressAttribute.setAddress(xorredAddr);
|
||||
xorredAddr =
|
||||
addressAttribute.applyXor(new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
xorredAddr = addressAttribute.applyXor(
|
||||
new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
|
||||
assertEquals("Double xorring didn't give the original ...",
|
||||
testAddress, xorredAddr);
|
||||
@ -259,9 +258,10 @@ public class AddressAttributeTest extends TestCase {
|
||||
*/
|
||||
public void testXorMappedAddressXoring_v6()
|
||||
{
|
||||
XorMappedAddressAttribute addressAttribute = new XorMappedAddressAttribute();
|
||||
TransportAddress testAddress =
|
||||
new TransportAddress("2001:660:4701:1001:202:8aff:febe:130b", 12120);
|
||||
XorMappedAddressAttribute addressAttribute
|
||||
= new XorMappedAddressAttribute();
|
||||
TransportAddress testAddress = new TransportAddress(
|
||||
"2001:660:4701:1001:202:8aff:febe:130b", 12120, Transport.UDP);
|
||||
|
||||
addressAttribute.setAddress(testAddress);
|
||||
|
||||
@ -285,36 +285,36 @@ public class AddressAttributeTest extends TestCase {
|
||||
|
||||
//Test xor-ing the original with the xored - should get the xor code
|
||||
addressAttribute.setAddress(testAddress);
|
||||
xorredAddr =
|
||||
addressAttribute.applyXor(new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
xorredAddr = addressAttribute.applyXor(
|
||||
new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
|
||||
xorredAddr =
|
||||
addressAttribute.applyXor(xorredAddr.getAddressBytes());
|
||||
xorredAddr = addressAttribute.applyXor(xorredAddr.getAddressBytes());
|
||||
|
||||
assertTrue("Xorring the original with the xor-ed didn't return the code..",
|
||||
Arrays.equals(
|
||||
xorredAddr.getAddressBytes(),
|
||||
new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36}));
|
||||
xorredAddr.getAddressBytes(),
|
||||
new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36}));
|
||||
|
||||
assertTrue("Port was not xorred",
|
||||
testAddress.getPort() != 0xFFFF);
|
||||
|
||||
//Test double xor-ing - should get the original
|
||||
addressAttribute.setAddress(testAddress);
|
||||
xorredAddr =
|
||||
addressAttribute.applyXor(new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
xorredAddr = addressAttribute.applyXor(
|
||||
new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
|
||||
addressAttribute.setAddress(xorredAddr);
|
||||
xorredAddr =
|
||||
addressAttribute.applyXor(new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
xorredAddr = addressAttribute.applyXor(
|
||||
new byte[]{21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36});
|
||||
|
||||
assertEquals("Double xorring didn't give the original ...",
|
||||
testAddress, xorredAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whetner sample binary arrays are correctly decoded.
|
||||
* @throws StunException
|
||||
* Test whether sample binary arrays are correctly decoded.
|
||||
*
|
||||
* @throws StunException if something goes wrong
|
||||
*/
|
||||
public void testDecodeAttributeBody() throws StunException {
|
||||
byte[] attributeValue = msgFixture.mappedAddress;
|
||||
@ -324,19 +324,20 @@ public class AddressAttributeTest extends TestCase {
|
||||
addressAttribute.decodeAttributeBody(attributeValue, offset, length);
|
||||
|
||||
|
||||
assertEquals("AddressAttribute.decode() did not properly decode the port field.",
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
addressAttribute.getPort());
|
||||
assertTrue("AddressAttribute.decode() did not properly decode the address field.",
|
||||
Arrays.equals( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
addressAttribute.getAddressBytes()));
|
||||
assertEquals(
|
||||
"AddressAttribute.decode() did not properly decode the port field.",
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT, addressAttribute.getPort());
|
||||
assertTrue(
|
||||
"AddressAttribute.decode() did not properly decode the address field.",
|
||||
Arrays.equals( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
addressAttribute.getAddressBytes()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whetner sample binary arrays are correctly decoded.
|
||||
* @throws StunException
|
||||
* @throws StunException if something goes wrong
|
||||
*/
|
||||
public void testDecodeAttributeBodyv6() throws StunException {
|
||||
byte[] attributeValue = msgFixture.mappedAddressv6;
|
||||
@ -362,16 +363,18 @@ public class AddressAttributeTest extends TestCase {
|
||||
* @throws StunException java.lang.Exception if we fail
|
||||
*/
|
||||
public void testEncode()
|
||||
throws StunException
|
||||
throws Exception
|
||||
{
|
||||
byte[] expectedReturn = msgFixture.mappedAddress;
|
||||
|
||||
addressAttribute.setAddress(
|
||||
new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP));
|
||||
|
||||
byte[] actualReturn = addressAttribute.encode();
|
||||
assertTrue("AddressAttribute.encode() did not properly encode a sample attribute",
|
||||
assertTrue("AddressAttribute.encode() did not "
|
||||
+"properly encode a sample attribute",
|
||||
Arrays.equals( expectedReturn, actualReturn));
|
||||
}
|
||||
|
||||
@ -381,13 +384,13 @@ public class AddressAttributeTest extends TestCase {
|
||||
* @throws StunException java.lang.Exception if we fail
|
||||
*/
|
||||
public void testEncodev6()
|
||||
throws StunException
|
||||
throws Exception
|
||||
{
|
||||
byte[] expectedReturn = msgFixture.mappedAddressv6;
|
||||
|
||||
addressAttribute.setAddress(
|
||||
new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT, Transport.UDP));
|
||||
|
||||
byte[] actualReturn = addressAttribute.encode();
|
||||
assertTrue("An AddressAttribute did not properly encode an IPv6 addr.",
|
||||
@ -402,7 +405,7 @@ public class AddressAttributeTest extends TestCase {
|
||||
* @throws StunException java.lang.Exception if we fail
|
||||
*/
|
||||
public void testEquals()
|
||||
throws StunException
|
||||
throws Exception
|
||||
{
|
||||
//null test
|
||||
AddressAttribute target = null;
|
||||
@ -416,34 +419,41 @@ public class AddressAttributeTest extends TestCase {
|
||||
target = new MappedAddressAttribute();
|
||||
|
||||
char port = (char)(msgFixture.ADDRESS_ATTRIBUTE_PORT + 1 );
|
||||
target.setAddress( new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
port));
|
||||
target.setAddress( new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS, port, Transport.UDP));
|
||||
|
||||
addressAttribute.setAddress(
|
||||
new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT ));
|
||||
addressAttribute.setAddress( new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP));
|
||||
|
||||
expectedReturn = false;
|
||||
actualReturn = addressAttribute.equals(target);
|
||||
assertEquals("AddressAttribute.equals() failed against a different target.",
|
||||
expectedReturn, actualReturn);
|
||||
assertEquals(
|
||||
"AddressAttribute.equals() failed against a different target.",
|
||||
expectedReturn, actualReturn);
|
||||
|
||||
//equality test
|
||||
target.setAddress( new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT ));
|
||||
target.setAddress( new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT, Transport.UDP ));
|
||||
|
||||
expectedReturn = true;
|
||||
actualReturn = addressAttribute.equals(target);
|
||||
assertEquals("AddressAttribute.equals() failed against an equal target.",
|
||||
expectedReturn, actualReturn);
|
||||
assertEquals(
|
||||
"AddressAttribute.equals() failed against an equal target.",
|
||||
expectedReturn, actualReturn);
|
||||
|
||||
//ipv6 equality test
|
||||
target.setAddress( new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
target.setAddress( new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT, Transport.UDP));
|
||||
|
||||
addressAttribute.setAddress(new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP));
|
||||
|
||||
addressAttribute.setAddress(
|
||||
new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT ));
|
||||
expectedReturn = true;
|
||||
actualReturn = addressAttribute.equals(target);
|
||||
assertEquals("AddressAttribute.equals() failed for IPv6 addresses.",
|
||||
@ -456,13 +466,14 @@ public class AddressAttributeTest extends TestCase {
|
||||
* @throws StunException java.lang.Exception if we fail
|
||||
*/
|
||||
public void testGetDataLength()
|
||||
throws StunException
|
||||
throws Exception
|
||||
{
|
||||
char expectedReturn = 8;//1-padding + 1-family + 2-port + 4-address
|
||||
|
||||
addressAttribute.setAddress(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
addressAttribute.setAddress( new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP));
|
||||
|
||||
char actualReturn = addressAttribute.getDataLength();
|
||||
|
||||
@ -470,9 +481,9 @@ public class AddressAttributeTest extends TestCase {
|
||||
expectedReturn, actualReturn);
|
||||
|
||||
expectedReturn = 20;//1-padding + 1-family + 2-port + 16-address
|
||||
addressAttribute.setAddress(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
addressAttribute.setAddress( new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT, Transport.UDP));
|
||||
|
||||
actualReturn = addressAttribute.getDataLength();
|
||||
|
||||
@ -483,20 +494,22 @@ public class AddressAttributeTest extends TestCase {
|
||||
/**
|
||||
* Tests that the address family is always 1.
|
||||
*/
|
||||
public void testGetFamily() {
|
||||
public void testGetFamily()
|
||||
throws Exception
|
||||
{
|
||||
byte expectedReturn = 1;
|
||||
addressAttribute.setAddress(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
addressAttribute.setAddress(new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT, Transport.UDP));
|
||||
byte actualReturn = addressAttribute.getFamily();
|
||||
assertEquals("Address family was not 1 for an IPv4",
|
||||
expectedReturn, actualReturn);
|
||||
|
||||
//ipv6
|
||||
expectedReturn = 2;
|
||||
addressAttribute.setAddress(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
addressAttribute.setAddress(new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT, Transport.UDP));
|
||||
actualReturn = addressAttribute.getFamily();
|
||||
assertEquals("Address family was not 2 for an IPv6 address",
|
||||
expectedReturn, actualReturn);
|
||||
|
||||
@ -51,7 +51,7 @@ public class AttributeDecoderTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testDecodeMappedAddress()
|
||||
throws StunException
|
||||
throws Exception
|
||||
{
|
||||
//
|
||||
byte[] bytes = msgFixture.mappedAddress;
|
||||
@ -61,17 +61,19 @@ public class AttributeDecoderTest extends TestCase {
|
||||
//create the message
|
||||
MappedAddressAttribute expectedReturn = new MappedAddressAttribute();
|
||||
|
||||
expectedReturn.setAddress(
|
||||
new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
expectedReturn.setAddress(new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP));
|
||||
|
||||
Attribute actualReturn = attributeDecoder.decode(bytes, offset, length);
|
||||
assertEquals("AttributeDecoder.decode() failed for a MAPPED-ADDRESS attribute",
|
||||
expectedReturn, actualReturn);
|
||||
assertEquals(
|
||||
"AttributeDecoder.decode() failed for a MAPPED-ADDRESS attribute",
|
||||
expectedReturn, actualReturn);
|
||||
}
|
||||
|
||||
public void testDecodeMappedAddress_v6()
|
||||
throws StunException
|
||||
throws Exception
|
||||
{
|
||||
//
|
||||
byte[] bytes = msgFixture.mappedAddressv6;
|
||||
@ -81,13 +83,15 @@ public class AttributeDecoderTest extends TestCase {
|
||||
//create the message
|
||||
MappedAddressAttribute expectedReturn = new MappedAddressAttribute();
|
||||
|
||||
expectedReturn.setAddress(
|
||||
new TransportAddress(msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
expectedReturn.setAddress( new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP));
|
||||
|
||||
Attribute actualReturn = attributeDecoder.decode(bytes, offset, length);
|
||||
assertEquals("AttributeDecoder.decode() failed for a MAPPED-ADDRESS attribute",
|
||||
expectedReturn, actualReturn);
|
||||
assertEquals(
|
||||
"AttributeDecoder.decode() failed for a MAPPED-ADDRESS attribute",
|
||||
expectedReturn, actualReturn);
|
||||
}
|
||||
|
||||
public void testDecodeChangeRequest()
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
/*
|
||||
* Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j.message;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.attribute.*;
|
||||
import org.ice4j.message.*;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
public class MessageFactoryTest extends TestCase {
|
||||
private MessageFactory messageFactory = null;
|
||||
@ -42,10 +41,12 @@ public class MessageFactoryTest extends TestCase {
|
||||
Response expectedReturn = new Response();
|
||||
expectedReturn.setMessageType(Message.BINDING_ERROR_RESPONSE);
|
||||
|
||||
Attribute errorCodeAtt = AttributeFactory.createErrorCodeAttribute(errorCode);
|
||||
Attribute errorCodeAtt
|
||||
= AttributeFactory.createErrorCodeAttribute(errorCode);
|
||||
expectedReturn.addAttribute(errorCodeAtt);
|
||||
|
||||
Message actualReturn = messageFactory.createBindingErrorResponse(errorCode);
|
||||
Message actualReturn
|
||||
= messageFactory.createBindingErrorResponse(errorCode);
|
||||
assertEquals("return value", expectedReturn, actualReturn);
|
||||
|
||||
}
|
||||
@ -57,11 +58,14 @@ public class MessageFactoryTest extends TestCase {
|
||||
Response expectedReturn = new Response();
|
||||
expectedReturn.setMessageType(Message.BINDING_ERROR_RESPONSE);
|
||||
|
||||
Attribute errorCodeAtt = AttributeFactory.createErrorCodeAttribute(errorCode, reasonPhrase);
|
||||
Attribute errorCodeAtt = AttributeFactory
|
||||
.createErrorCodeAttribute(errorCode, reasonPhrase);
|
||||
expectedReturn.addAttribute(errorCodeAtt);
|
||||
|
||||
Message actualReturn = messageFactory.createBindingErrorResponse(errorCode, reasonPhrase);
|
||||
assertEquals("Failed to create an error code attribute.", expectedReturn, actualReturn);
|
||||
Message actualReturn = messageFactory
|
||||
.createBindingErrorResponse(errorCode, reasonPhrase);
|
||||
assertEquals("Failed to create an error code attribute.",
|
||||
expectedReturn, actualReturn);
|
||||
|
||||
}
|
||||
|
||||
@ -75,8 +79,10 @@ public class MessageFactoryTest extends TestCase {
|
||||
Response expectedReturn = new Response();
|
||||
expectedReturn.setMessageType(Message.BINDING_ERROR_RESPONSE);
|
||||
|
||||
Attribute errorCodeAtt = AttributeFactory.createErrorCodeAttribute(errorCode);
|
||||
((ErrorCodeAttribute)errorCodeAtt).setReasonPhrase(ErrorCodeAttribute.getDefaultReasonPhrase(errorCode));
|
||||
Attribute errorCodeAtt = AttributeFactory
|
||||
.createErrorCodeAttribute(errorCode);
|
||||
((ErrorCodeAttribute)errorCodeAtt).setReasonPhrase(
|
||||
ErrorCodeAttribute.getDefaultReasonPhrase(errorCode));
|
||||
expectedReturn.addAttribute(errorCodeAtt);
|
||||
|
||||
UnknownAttributesAttribute unknownAtts =
|
||||
@ -88,7 +94,8 @@ public class MessageFactoryTest extends TestCase {
|
||||
expectedReturn.addAttribute(unknownAtts);
|
||||
|
||||
//create the same message using the factory
|
||||
Message actualReturn = messageFactory.createBindingErrorResponseUnknownAttributes(unknownAttributes);
|
||||
Message actualReturn = messageFactory
|
||||
.createBindingErrorResponseUnknownAttributes(unknownAttributes);
|
||||
//compare
|
||||
assertEquals("return value", expectedReturn, actualReturn);
|
||||
|
||||
@ -117,12 +124,14 @@ public class MessageFactoryTest extends TestCase {
|
||||
}
|
||||
expectedReturn.addAttribute(unknownAtts);
|
||||
|
||||
Message actualReturn = messageFactory.createBindingErrorResponseUnknownAttributes(
|
||||
reasonPhrase, unknownAttributes);
|
||||
Message actualReturn = messageFactory
|
||||
.createBindingErrorResponseUnknownAttributes(
|
||||
reasonPhrase, unknownAttributes);
|
||||
assertEquals("return value", expectedReturn, actualReturn);
|
||||
}
|
||||
|
||||
public void testCreateBindingRequest() throws StunException {
|
||||
public void testCreateBindingRequest() throws StunException
|
||||
{
|
||||
Request bindingRequest = new Request();
|
||||
Request expectedReturn = bindingRequest;
|
||||
bindingRequest.setMessageType(Message.BINDING_REQUEST);
|
||||
@ -136,32 +145,44 @@ public class MessageFactoryTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testCreateBindingResponse()
|
||||
throws StunException
|
||||
throws Exception
|
||||
{
|
||||
Response bindingResponse = new Response();
|
||||
bindingResponse.setMessageType(Message.BINDING_RESPONSE);
|
||||
|
||||
Attribute mappedAddress = AttributeFactory.createMappedAddressAttribute(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP));
|
||||
|
||||
bindingResponse.addAttribute(mappedAddress);
|
||||
|
||||
Attribute sourceAddress = AttributeFactory.createSourceAddressAttribute(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_2, msgFixture.ADDRESS_ATTRIBUTE_PORT_2));
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_2,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_2,
|
||||
Transport.UDP));
|
||||
|
||||
bindingResponse.addAttribute(sourceAddress);
|
||||
|
||||
Attribute changedAddress = AttributeFactory.
|
||||
createChangedAddressAttribute(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_3, msgFixture.ADDRESS_ATTRIBUTE_PORT_3));
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_3,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_3,
|
||||
Transport.UDP));
|
||||
|
||||
bindingResponse.addAttribute(changedAddress);
|
||||
|
||||
Message expectedReturn = bindingResponse;
|
||||
Message actualReturn = messageFactory.createBindingResponse(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS, msgFixture.ADDRESS_ATTRIBUTE_PORT),
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_2,msgFixture.ADDRESS_ATTRIBUTE_PORT_2),
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_3,msgFixture.ADDRESS_ATTRIBUTE_PORT_3));
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP),
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_2,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_2,
|
||||
Transport.UDP),
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_3,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_3,
|
||||
Transport.UDP));
|
||||
assertEquals("return value", expectedReturn, actualReturn);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
/*
|
||||
* Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j.message;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.attribute.*;
|
||||
import org.ice4j.message.*;
|
||||
|
||||
public class MessageTest extends TestCase {
|
||||
private Message bindingRequest = null;
|
||||
@ -52,17 +51,24 @@ public class MessageTest extends TestCase {
|
||||
bindingResponse.setMessageType(Message.BINDING_RESPONSE);
|
||||
|
||||
mappedAddress = AttributeFactory.createMappedAddressAttribute(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS, msgFixture.ADDRESS_ATTRIBUTE_PORT));
|
||||
new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||
Transport.UDP));
|
||||
|
||||
bindingResponse.addAttribute(mappedAddress);
|
||||
|
||||
sourceAddress = AttributeFactory.createSourceAddressAttribute(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_2, msgFixture.ADDRESS_ATTRIBUTE_PORT_2));
|
||||
new TransportAddress(
|
||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_2,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_2,
|
||||
Transport.UDP));
|
||||
|
||||
bindingResponse.addAttribute(sourceAddress);
|
||||
|
||||
changedAddress = AttributeFactory.createChangedAddressAttribute(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_3,msgFixture.ADDRESS_ATTRIBUTE_PORT_3));
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_3,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_3, Transport.UDP));
|
||||
|
||||
bindingResponse.addAttribute(changedAddress);
|
||||
bindingResponse.setTransactionID(msgFixture.TRANSACTION_ID);
|
||||
|
||||
@ -1,23 +1,19 @@
|
||||
/*
|
||||
* Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j.stack;
|
||||
|
||||
import junit.framework.*;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.DatagramPacket;
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.message.*;
|
||||
import org.ice4j.stack.*;
|
||||
|
||||
/**
|
||||
* All unit stack tests should be provided later. I just don't have the time now.
|
||||
@ -41,7 +37,8 @@ public class ShallowStackTest extends TestCase {
|
||||
|
||||
private DatagramCollector dgramCollector = new DatagramCollector();
|
||||
|
||||
private NetAccessPointDescriptor apDescriptor = null;
|
||||
private TransportAddress localAddress = null;
|
||||
private DatagramSocket localSock = null;
|
||||
|
||||
private DatagramSocket dummyImplSocket = null;
|
||||
private DatagramPacket bindingRequestPacket
|
||||
@ -58,21 +55,20 @@ public class ShallowStackTest extends TestCase {
|
||||
msgFixture = new MsgFixture();
|
||||
msgFixture.setUp();
|
||||
//Addresses
|
||||
stun4jAddressOfDummyImpl =
|
||||
new TransportAddress(InetAddress.getByName("127.0.0.1"), 6000);
|
||||
socketAddressOfStun4jStack =
|
||||
new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 5000);
|
||||
stun4jAddressOfDummyImpl = new TransportAddress(
|
||||
"127.0.0.1", 6000, Transport.UDP);
|
||||
socketAddressOfStun4jStack = new TransportAddress(
|
||||
"127.0.0.1", 5000, Transport.UDP);
|
||||
|
||||
//init the stack
|
||||
stunStack = StunStack.getInstance();
|
||||
|
||||
stunProvider = stunStack.getProvider();
|
||||
|
||||
//access point
|
||||
apDescriptor = new NetAccessPointDescriptor(
|
||||
new TransportAddress(InetAddress.getByName("127.0.0.1"), 5000));
|
||||
//access point
|
||||
localAddress = new TransportAddress("127.0.0.1", 5000, Transport.UDP);
|
||||
localSock = new DatagramSocket(localAddress);
|
||||
|
||||
stunStack.installNetAccessPoint(apDescriptor);
|
||||
stunStack.installNetAccessPoint(localSock);
|
||||
|
||||
//init the phoney stack
|
||||
dummyImplSocket = new DatagramSocket( 6000 );
|
||||
@ -106,7 +102,7 @@ public class ShallowStackTest extends TestCase {
|
||||
|
||||
stunProvider.sendRequest(bindingRequest,
|
||||
stun4jAddressOfDummyImpl,
|
||||
apDescriptor,
|
||||
localAddress,
|
||||
new SimpleResponseCollector());
|
||||
|
||||
//wait for its arrival
|
||||
@ -217,18 +213,18 @@ public class ShallowStackTest extends TestCase {
|
||||
//---------- create the response ---------------------------------------
|
||||
Response bindingResponse = MessageFactory.createBindingResponse(
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT ),
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT, Transport.UDP ),
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_2,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_2),
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_2, Transport.UDP),
|
||||
new TransportAddress( msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_3,
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_3));
|
||||
msgFixture.ADDRESS_ATTRIBUTE_PORT_3, Transport.UDP));
|
||||
|
||||
//---------- send & receive the response -------------------------------
|
||||
dgramCollector.startListening(dummyImplSocket);
|
||||
|
||||
stunProvider.sendResponse(collectedRequest.getTransactionID(),
|
||||
bindingResponse,
|
||||
apDescriptor,
|
||||
localAddress,
|
||||
stun4jAddressOfDummyImpl);
|
||||
|
||||
//wait for its arrival
|
||||
@ -258,7 +254,7 @@ public class ShallowStackTest extends TestCase {
|
||||
|
||||
stunProvider.sendRequest(bindingRequest,
|
||||
stun4jAddressOfDummyImpl,
|
||||
apDescriptor,
|
||||
localAddress,
|
||||
collector);
|
||||
|
||||
//wait for its arrival
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
/*
|
||||
* Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j.stunclient;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.logging.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.message.*;
|
||||
@ -38,8 +39,8 @@ public class ResponseSequenceServer
|
||||
private StunStack stunStack = null;
|
||||
private StunProvider stunProvider = null;
|
||||
|
||||
private TransportAddress serverAddress = null;
|
||||
private NetAccessPointDescriptor apDescriptor = null;
|
||||
private TransportAddress serverAddress = null;
|
||||
private DatagramSocket localSocket = null;
|
||||
|
||||
public ResponseSequenceServer(TransportAddress bindAddress)
|
||||
{
|
||||
@ -57,10 +58,10 @@ public class ResponseSequenceServer
|
||||
stunStack = StunStack.getInstance();
|
||||
stunProvider = stunStack.getProvider();
|
||||
|
||||
apDescriptor = new NetAccessPointDescriptor(serverAddress);
|
||||
localSocket = new DatagramSocket(serverAddress);
|
||||
|
||||
stunStack.installNetAccessPoint(apDescriptor);
|
||||
stunProvider.addRequestListener(apDescriptor, this);
|
||||
stunStack.installNetAccessPoint(localSocket);
|
||||
stunProvider.addRequestListener(serverAddress, this);
|
||||
|
||||
}
|
||||
|
||||
@ -70,6 +71,7 @@ public class ResponseSequenceServer
|
||||
public void shutDown()
|
||||
{
|
||||
messageSequence.removeAllElements();
|
||||
localSocket.close();
|
||||
|
||||
stunStack = null;
|
||||
stunProvider = null;
|
||||
@ -111,9 +113,7 @@ public class ResponseSequenceServer
|
||||
try
|
||||
{
|
||||
stunProvider.sendResponse(evt.getMessage().getTransactionID(),
|
||||
res,
|
||||
apDescriptor,
|
||||
evt.getRemoteAddress());
|
||||
res, serverAddress, evt.getRemoteAddress());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
/*
|
||||
* Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j.stunclient;
|
||||
|
||||
import junit.framework.*;
|
||||
import java.io.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.message.*;
|
||||
import org.ice4j.stunclient.*;
|
||||
|
||||
/**
|
||||
* The StunAddressDiscovererTest_XXX set of tests were created to verify stun
|
||||
@ -27,17 +25,18 @@ public class StunAddressDiscovererTest
|
||||
extends TestCase
|
||||
{
|
||||
private NetworkConfigurationDiscoveryProcess stunAddressDiscoverer = null;
|
||||
private TransportAddress discovererAddress = new TransportAddress("127.0.0.1", 15555);
|
||||
private TransportAddress discovererAddress
|
||||
= new TransportAddress("127.0.0.1", 15555, Transport.UDP);
|
||||
|
||||
private ResponseSequenceServer responseServer = null;
|
||||
private TransportAddress responseServerAddress
|
||||
= new TransportAddress("127.0.0.1", 19999);
|
||||
= new TransportAddress("127.0.0.1", 19999, Transport.UDP);
|
||||
|
||||
|
||||
private TransportAddress mappedClientAddress
|
||||
= new TransportAddress("212.56.4.10", 15612);
|
||||
= new TransportAddress("212.56.4.10", 15612, Transport.UDP);
|
||||
private TransportAddress mappedClientAddressPort2
|
||||
= new TransportAddress("212.56.4.10", 15611);
|
||||
= new TransportAddress("212.56.4.10", 15611, Transport.UDP);
|
||||
|
||||
public StunAddressDiscovererTest(String name)
|
||||
throws StunException
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
/*
|
||||
* Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j.stunclient;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.message.*;
|
||||
import org.ice4j.stunclient.*;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
/**
|
||||
* Makes basic stun tests for cases where local network addresses and the public
|
||||
@ -34,27 +33,28 @@ public class StunAddressDiscovererTest_v4v6 extends TestCase {
|
||||
= null;
|
||||
|
||||
private TransportAddress discovererAddress_v4
|
||||
= new TransportAddress("127.0.0.1", 17555);
|
||||
= new TransportAddress("127.0.0.1", 17555, Transport.UDP);
|
||||
private TransportAddress discovererAddress_v6
|
||||
= new TransportAddress("::1", 17555);
|
||||
= new TransportAddress("::1", 17555, Transport.UDP);
|
||||
|
||||
private ResponseSequenceServer responseServer_v6 = null;
|
||||
private ResponseSequenceServer responseServer_v4 = null;
|
||||
private ResponseSequenceServer responseServer_v6 = null;
|
||||
private ResponseSequenceServer responseServer_v4 = null;
|
||||
|
||||
private TransportAddress responseServerAddress_v6
|
||||
= new TransportAddress("::1", 21999);
|
||||
= new TransportAddress("::1", 21999, Transport.UDP);
|
||||
private TransportAddress responseServerAddress_v4
|
||||
= new TransportAddress("127.0.0.1", 21999);
|
||||
= new TransportAddress("127.0.0.1", 21999, Transport.UDP);
|
||||
|
||||
private TransportAddress mappedClientAddress_v6
|
||||
= new TransportAddress("2001:660:4701:1001:ff::1", 17612);
|
||||
private TransportAddress mappedClientAddress_v6 = new TransportAddress(
|
||||
"2001:660:4701:1001:ff::1", 17612, Transport.UDP);
|
||||
private TransportAddress mappedClientAddress_v6_Port2
|
||||
= new TransportAddress("2001:660:4701:1001:ff::1", 17611);
|
||||
= new TransportAddress(
|
||||
"2001:660:4701:1001:ff::1", 17611, Transport.UDP);
|
||||
|
||||
private TransportAddress mappedClientAddress_v4
|
||||
= new TransportAddress("130.79.99.55", 17612);
|
||||
= new TransportAddress("130.79.99.55", 17612, Transport.UDP);
|
||||
private TransportAddress mappedClientAddress_v4_Port2
|
||||
= new TransportAddress("130.79.99.55", 17611);
|
||||
= new TransportAddress("130.79.99.55", 17611, Transport.UDP);
|
||||
|
||||
public StunAddressDiscovererTest_v4v6(String name)
|
||||
throws StunException
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
/*
|
||||
* Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* ice4j, the OpenSource Java Solution for NAT and Firewall Traversal.
|
||||
* Maintained by the SIP Communicator community (http://sip-communicator.org).
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
* Distributable under LGPL license. See terms of license at gnu.org.
|
||||
*/
|
||||
package org.ice4j.stunclient;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
import org.ice4j.*;
|
||||
import org.ice4j.message.*;
|
||||
import org.ice4j.stunclient.*;
|
||||
|
||||
import junit.framework.*;
|
||||
|
||||
/**
|
||||
* The StunAddressDiscovererTest_XXX set of tests were created to verify stun
|
||||
@ -24,15 +23,17 @@ import junit.framework.*;
|
||||
*/
|
||||
public class StunAddressDiscovererTest_v6 extends TestCase {
|
||||
private NetworkConfigurationDiscoveryProcess stunAddressDiscoverer = null;
|
||||
private TransportAddress discovererAddress = new TransportAddress("::1", 16555);
|
||||
private TransportAddress discovererAddress
|
||||
= new TransportAddress("::1", 16555, Transport.UDP);
|
||||
|
||||
private ResponseSequenceServer responseServer = null;
|
||||
private TransportAddress responseServerAddress = new TransportAddress("::1", 20999);
|
||||
private TransportAddress responseServerAddress
|
||||
= new TransportAddress("::1", 20999, Transport.UDP);
|
||||
|
||||
private TransportAddress mappedClientAddress
|
||||
= new TransportAddress("2001:660:4701:1001:ff::1", 16612);
|
||||
private TransportAddress mappedClientAddressPort2
|
||||
= new TransportAddress("2001:660:4701:1001:ff::1", 16611);
|
||||
private TransportAddress mappedClientAddress = new TransportAddress(
|
||||
"2001:660:4701:1001:ff::1", 16612, Transport.UDP);
|
||||
private TransportAddress mappedClientAddressPort2 = new TransportAddress(
|
||||
"2001:660:4701:1001:ff::1", 16611, Transport.UDP);
|
||||
|
||||
public StunAddressDiscovererTest_v6(String name)
|
||||
throws StunException
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user