Added support for validation of incoming FINGERPRINT attribtues
This commit is contained in:
parent
96864b9489
commit
2f3a192612
@ -62,11 +62,14 @@ public class AttributeDecoderTest extends TestCase {
|
|||||||
MappedAddressAttribute expectedReturn = new MappedAddressAttribute();
|
MappedAddressAttribute expectedReturn = new MappedAddressAttribute();
|
||||||
|
|
||||||
expectedReturn.setAddress(new TransportAddress(
|
expectedReturn.setAddress(new TransportAddress(
|
||||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
MsgFixture.ADDRESS_ATTRIBUTE_ADDRESS,
|
||||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
MsgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||||
Transport.UDP));
|
Transport.UDP));
|
||||||
|
|
||||||
Attribute actualReturn = attributeDecoder.decode(bytes, offset, length);
|
Attribute actualReturn = AttributeDecoder.decode(
|
||||||
|
bytes, offset, length, //attribute
|
||||||
|
bytes, (char)0, offset);//message head
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"AttributeDecoder.decode() failed for a MAPPED-ADDRESS attribute",
|
"AttributeDecoder.decode() failed for a MAPPED-ADDRESS attribute",
|
||||||
expectedReturn, actualReturn);
|
expectedReturn, actualReturn);
|
||||||
@ -84,11 +87,14 @@ public class AttributeDecoderTest extends TestCase {
|
|||||||
MappedAddressAttribute expectedReturn = new MappedAddressAttribute();
|
MappedAddressAttribute expectedReturn = new MappedAddressAttribute();
|
||||||
|
|
||||||
expectedReturn.setAddress( new TransportAddress(
|
expectedReturn.setAddress( new TransportAddress(
|
||||||
msgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
MsgFixture.ADDRESS_ATTRIBUTE_ADDRESS_V6,
|
||||||
msgFixture.ADDRESS_ATTRIBUTE_PORT,
|
MsgFixture.ADDRESS_ATTRIBUTE_PORT,
|
||||||
Transport.UDP));
|
Transport.UDP));
|
||||||
|
|
||||||
Attribute actualReturn = attributeDecoder.decode(bytes, offset, length);
|
Attribute actualReturn = AttributeDecoder.decode(
|
||||||
|
bytes, offset, length, //attribute
|
||||||
|
bytes, (char)0, offset);//message head
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"AttributeDecoder.decode() failed for a MAPPED-ADDRESS attribute",
|
"AttributeDecoder.decode() failed for a MAPPED-ADDRESS attribute",
|
||||||
expectedReturn, actualReturn);
|
expectedReturn, actualReturn);
|
||||||
@ -104,10 +110,12 @@ public class AttributeDecoderTest extends TestCase {
|
|||||||
|
|
||||||
//create the message
|
//create the message
|
||||||
ChangeRequestAttribute expectedReturn = new ChangeRequestAttribute();
|
ChangeRequestAttribute expectedReturn = new ChangeRequestAttribute();
|
||||||
expectedReturn.setChangeIpFlag(msgFixture.CHANGE_IP_FLAG_1);
|
expectedReturn.setChangeIpFlag(MsgFixture.CHANGE_IP_FLAG_1);
|
||||||
expectedReturn.setChangePortFlag(msgFixture.CHANGE_PORT_FLAG_1);
|
expectedReturn.setChangePortFlag(MsgFixture.CHANGE_PORT_FLAG_1);
|
||||||
|
|
||||||
Attribute actualReturn = attributeDecoder.decode(bytes, offset, length);
|
Attribute actualReturn = AttributeDecoder.decode(
|
||||||
|
bytes, offset, length, //attribute
|
||||||
|
bytes, (char)0, offset);//message head
|
||||||
assertEquals("AttributeDecoder.decode() failed for a CHANGE-REQUEST attribute",
|
assertEquals("AttributeDecoder.decode() failed for a CHANGE-REQUEST attribute",
|
||||||
expectedReturn, actualReturn);
|
expectedReturn, actualReturn);
|
||||||
|
|
||||||
@ -124,13 +132,16 @@ public class AttributeDecoderTest extends TestCase {
|
|||||||
|
|
||||||
//create the message
|
//create the message
|
||||||
ErrorCodeAttribute expectedReturn = new ErrorCodeAttribute();
|
ErrorCodeAttribute expectedReturn = new ErrorCodeAttribute();
|
||||||
expectedReturn.setErrorClass(msgFixture.ERROR_CLASS);
|
expectedReturn.setErrorClass(MsgFixture.ERROR_CLASS);
|
||||||
expectedReturn.setErrorNumber(msgFixture.ERROR_NUMBER);
|
expectedReturn.setErrorNumber(MsgFixture.ERROR_NUMBER);
|
||||||
expectedReturn.setReasonPhrase(msgFixture.REASON_PHRASE);
|
expectedReturn.setReasonPhrase(MsgFixture.REASON_PHRASE);
|
||||||
|
|
||||||
Attribute actualReturn = attributeDecoder.decode(bytes, offset, length);
|
Attribute actualReturn = AttributeDecoder.decode(
|
||||||
assertEquals("AttributeDecoder.decode() failed for a ERROR-CODE attribute",
|
bytes, offset, length, //attribute
|
||||||
expectedReturn, actualReturn);
|
bytes, (char)0, offset);//message head
|
||||||
|
assertEquals(
|
||||||
|
"AttributeDecoder.decode() failed for a ERROR-CODE attribute",
|
||||||
|
expectedReturn, actualReturn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,11 +155,14 @@ public class AttributeDecoderTest extends TestCase {
|
|||||||
|
|
||||||
//create the message
|
//create the message
|
||||||
UnknownAttributesAttribute expectedReturn = new UnknownAttributesAttribute();
|
UnknownAttributesAttribute expectedReturn = new UnknownAttributesAttribute();
|
||||||
expectedReturn.addAttributeID(msgFixture.UNKNOWN_ATTRIBUTES_1ST_ATT);
|
expectedReturn.addAttributeID(MsgFixture.UNKNOWN_ATTRIBUTES_1ST_ATT);
|
||||||
expectedReturn.addAttributeID(msgFixture.UNKNOWN_ATTRIBUTES_2ND_ATT);
|
expectedReturn.addAttributeID(MsgFixture.UNKNOWN_ATTRIBUTES_2ND_ATT);
|
||||||
expectedReturn.addAttributeID(msgFixture.UNKNOWN_ATTRIBUTES_3D_ATT);
|
expectedReturn.addAttributeID(MsgFixture.UNKNOWN_ATTRIBUTES_3D_ATT);
|
||||||
|
|
||||||
|
Attribute actualReturn = AttributeDecoder.decode(
|
||||||
|
bytes, offset, length, //attribute
|
||||||
|
bytes, (char)0, offset);//message head
|
||||||
|
|
||||||
Attribute actualReturn = attributeDecoder.decode(bytes, offset, length);
|
|
||||||
assertEquals("AttributeDecoder.decode() failed for a ERROR-CODE attribute",
|
assertEquals("AttributeDecoder.decode() failed for a ERROR-CODE attribute",
|
||||||
expectedReturn, actualReturn);
|
expectedReturn, actualReturn);
|
||||||
|
|
||||||
@ -168,9 +182,12 @@ public class AttributeDecoderTest extends TestCase {
|
|||||||
expectedReturn.setBody(expectedAttributeValue, 0,
|
expectedReturn.setBody(expectedAttributeValue, 0,
|
||||||
expectedAttributeValue.length);
|
expectedAttributeValue.length);
|
||||||
|
|
||||||
Attribute actualReturn = attributeDecoder.decode(bytes, offset, length);
|
Attribute actualReturn = AttributeDecoder.decode(
|
||||||
assertEquals("AttributeDecoder.decode() failed for a UNKNOWN_OPTIONAL attribute",
|
bytes, offset, length, //attribute
|
||||||
expectedReturn, actualReturn);
|
bytes, (char)0, offset);//message head
|
||||||
|
assertEquals(
|
||||||
|
"AttributeDecoder.decode() failed for a UNKNOWN_OPTIONAL attribute",
|
||||||
|
expectedReturn, actualReturn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,10 +41,10 @@ public class Ice
|
|||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
|
|
||||||
transferRemoteCandidates(localAgent, remotePeer);
|
transferRemoteCandidates(localAgent, remotePeer);
|
||||||
localAgent.setRemoteUserName(remotePeer.getUserName());
|
localAgent.setRemoteUfrag(remotePeer.getLocalUfrag());
|
||||||
localAgent.setRemotePassword(remotePeer.getPassword());
|
localAgent.setRemotePassword(remotePeer.getPassword());
|
||||||
|
|
||||||
remotePeer.setRemoteUserName(localAgent.getUserName());
|
remotePeer.setRemoteUfrag(localAgent.getLocalUfrag());
|
||||||
remotePeer.setRemotePassword(localAgent.getPassword());
|
remotePeer.setRemotePassword(localAgent.getPassword());
|
||||||
|
|
||||||
System.out.println("Total candidate gathering time: "
|
System.out.println("Total candidate gathering time: "
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user