package org.mobicents.protocols.ss7.sccp.impl;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitiveFactory;
import org.mobicents.protocols.ss7.mtp.RoutingLabelFormat;
import org.mobicents.protocols.ss7.sccp.NetworkIdState;
import org.mobicents.protocols.ss7.sccp.RemoteSccpStatus;
import org.mobicents.protocols.ss7.sccp.SccpListener;
import org.mobicents.protocols.ss7.sccp.SignallingPointStatus;
import org.mobicents.protocols.ss7.sccp.impl.router.RouterImpl;
import org.mobicents.protocols.ss7.sccp.message.SccpDataMessage;
import org.mobicents.protocols.ss7.sccp.message.SccpNoticeMessage;
import org.testng.annotations.Test;
public class XudtReassemblingTest {
private byte data1[] = new byte[] { 0x11, (byte) 0x81, 0x0f, 0x04, 0x0d, 0x16, (byte) 0xff, 0x09, 0x0a, 0x06, 0x01, 0x09,
0x00, 0x08, 0x00, 0x01, 0x20, 0x09, 0x0a, 0x07, 0x01, 0x09, 0x00, 0x08, 0x00, 0x02, 0x10, (byte) 0xe9, 0x62,
(byte) 0x81, (byte) 0xff, 0x48, 0x04, 0x04, 0x00, 0x00, 0x29, 0x6b, 0x1a, 0x28, 0x18, 0x06, 0x07, 0x00, 0x11,
(byte) 0x86, 0x05, 0x01, 0x01, 0x01, (byte) 0xa0, 0x0d, 0x60, 0x0b, (byte) 0xa1, 0x09, 0x06, 0x07, 0x04, 0x00,
0x00, 0x01, 0x00, 0x01, 0x03, 0x6c, (byte) 0x81, (byte) 0xda, (byte) 0xa1, (byte) 0x81, (byte) 0xd7, 0x02, 0x01,
0x01, 0x02, 0x01, 0x02, 0x30, (byte) 0x81, (byte) 0xce, 0x04, 0x08, 0x04, 0x04, 0x11, 0x01, 0x00, 0x09, 0x00,
(byte) 0xf2, (byte) 0x81, 0x07, (byte) 0x91, 0x09, 0x00, 0x08, 0x00, 0x02, 0x10, 0x04, 0x07, (byte) 0x91, 0x09,
0x00, 0x08, 0x00, 0x02, 0x10, 0x30, 0x3a, (byte) 0xa0, 0x38, 0x30, 0x36, 0x06, 0x02, 0x29, 0x01, (byte) 0x82, 0x30,
(byte) 0x91, 0x19, (byte) 0x81, 0x01, 0x0e, (byte) 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0xa6, 0x62, (byte) 0x80,
0x02, 0x05, (byte) 0xe0, 0x30, 0x3a, (byte) 0xa0, 0x38, 0x30, 0x36, 0x06, 0x02, 0x29, 0x01, (byte) 0x82, 0x30,
(byte) 0x91, 0x19, (byte) 0x81, 0x01, 0x0e, (byte) 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x82, 0x00, (byte) 0x81,
0x01, 0x00, (byte) 0xa3, 0x07, (byte) 0x81, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, (byte) 0x84, 0x00, (byte) 0x85,
0x03, 0x00, 0x01, 0x01, (byte) 0x86, 0x03, 0x00, 0x01, 0x01, (byte) 0x87, 0x10, 0x04, (byte) 0x81, 0x04, 0x00,
0x04, 0x00 };
private byte data2[] = new byte[] { 0x11, (byte) 0x81, 0x0f, 0x04, 0x0d, 0x16, 0x2f, 0x09, 0x0a, 0x06, 0x01, 0x09, 0x00,
0x08, 0x00, 0x01, 0x20, 0x09, 0x0a, 0x07, 0x01, 0x09, 0x00, 0x08, 0x00, 0x02, 0x10, 0x19, 0x02, 0x00, 0x01,
(byte) 0x88, 0x00, (byte) 0x89, 0x00, (byte) 0x8b, 0x00, (byte) 0x8c, 0x00, (byte) 0xad, 0x0a, (byte) 0x80, 0x08,
0x53, (byte) 0x83, 0x61, 0x50, 0x01, 0x47, 0x33, (byte) 0xf0, (byte) 0x90, 0x00, 0x10, 0x04, 0x00, 0x04, 0x00,
0x04, 0x00 };
@Test
public void testA() throws Exception {
SccpStackImpl sccpStack = new SccpStackImpl("TestUudt");
sccpStack.start();
SccpListenerProxy listenerProxy = new SccpListenerProxy();
sccpStack.getSccpProvider().registerSccpListener(8, listenerProxy);
sccpStack.setMtp3UserPart(1, new Mtp3UserPartImpl());
sccpStack.removeAllResourses();
RouterImpl router = (RouterImpl) sccpStack.getRouter();
router.addMtp3ServiceAccessPoint(1, 1, 1002, 2, 0);
Mtp3TransferPrimitiveFactory mtp3TransferPrimitiveFactory = new Mtp3TransferPrimitiveFactory(RoutingLabelFormat.ITU);
Mtp3TransferPrimitive mtp3Msg = mtp3TransferPrimitiveFactory.createMtp3TransferPrimitive(3, 2, 0, 1001, 1002, 5, data1);
sccpStack.onMtp3TransferMessage(mtp3Msg);
mtp3TransferPrimitiveFactory = new Mtp3TransferPrimitiveFactory(RoutingLabelFormat.ITU);
mtp3Msg = mtp3TransferPrimitiveFactory.createMtp3TransferPrimitive(3, 2, 0, 1001, 1002, 5, data2);
sccpStack.onMtp3TransferMessage(mtp3Msg);
}
private class SccpListenerProxy implements SccpListener {
@Override
public void onMessage(SccpDataMessage message) {
// TODO Auto-generated method stub
}
@Override
public void onNotice(SccpNoticeMessage message) {
// TODO Auto-generated method stub
}
@Override
public void onCoordResponse(int ssn, int multiplicityIndicator) {
// TODO Auto-generated method stub
}
@Override
public void onState(int dpc, int ssn, boolean inService, int multiplicityIndicator) {
// TODO Auto-generated method stub
}
@Override
public void onPcState(int dpc, SignallingPointStatus status, Integer restrictedImportanceLevel,
RemoteSccpStatus remoteSccpStatus) {
// TODO Auto-generated method stub
}
@Override
public void onNetworkIdState(int networkId, NetworkIdState networkIdState) {
}
}
}