@Test(groups = {"functional.encode", "circuitSwitchedCall"})
  public void testEncode() throws Exception {

    GenericNumberImpl genericNumber = new GenericNumberImpl(1, "1122", 1, 0, 0, false, 1);
    // int natureOfAddresIndicator, String address, int numberQualifierIndicator, int
    // numberingPlanIndicator, int
    // addressRepresentationREstrictedIndicator,
    // boolean numberIncomplete, int screeningIndicator
    DigitsImpl assistingSSPIPRoutingAddress = new DigitsImpl(genericNumber);
    GenericDigitsImpl genericDigits = new GenericDigitsImpl(2, 0, getCorrelationIDDigits());
    // int encodingScheme, int typeOfDigits, int[] digits
    DigitsImpl correlationID = new DigitsImpl(genericDigits);
    ScfIDImpl scfID = new ScfIDImpl(getScfIDData());
    ServiceInteractionIndicatorsTwoImpl serviceInteractionIndicatorsTwo =
        new ServiceInteractionIndicatorsTwoImpl(
            null,
            null,
            BothwayThroughConnectionInd.bothwayPathNotRequired,
            null,
            false,
            null,
            null,
            null);
    // ForwardServiceInteractionInd forwardServiceInteractionInd,
    // BackwardServiceInteractionInd backwardServiceInteractionInd, BothwayThroughConnectionInd
    // bothwayThroughConnectionInd,
    // ConnectedNumberTreatmentInd connectedNumberTreatmentInd, boolean nonCUGCall,
    // HoldTreatmentIndicator
    // holdTreatmentIndicator,
    // CwTreatmentIndicator cwTreatmentIndicator, EctTreatmentIndicator ectTreatmentIndicator
    NAOliInfoImpl naOliInfo = new NAOliInfoImpl(11);

    EstablishTemporaryConnectionRequestImpl elem =
        new EstablishTemporaryConnectionRequestImpl(
            assistingSSPIPRoutingAddress,
            correlationID,
            scfID,
            CAPExtensionsTest.createTestCAPExtensions(),
            null,
            serviceInteractionIndicatorsTwo,
            null,
            naOliInfo,
            null,
            null,
            null,
            false);
    AsnOutputStream aos = new AsnOutputStream();
    elem.encodeAll(aos);
    assertTrue(Arrays.equals(aos.toByteArray(), this.getData1()));

    // Digits assistingSSPIPRoutingAddress, Digits correlationID, ScfID scfID, CAPExtensions
    // extensions,
    // Carrier carrier, ServiceInteractionIndicatorsTwo serviceInteractionIndicatorsTwo, Integer
    // callSegmentID, NAOliInfo
    // naOliInfo,
    // LocationNumberCap chargeNumber, OriginalCalledNumberCap originalCalledPartyID,
    // CallingPartyNumberCap
    // callingPartyNumber,
    // boolean isCAPVersion3orLater

    elem =
        new EstablishTemporaryConnectionRequestImpl(
            assistingSSPIPRoutingAddress,
            correlationID,
            scfID,
            CAPExtensionsTest.createTestCAPExtensions(),
            null,
            serviceInteractionIndicatorsTwo,
            8,
            naOliInfo,
            null,
            null,
            null,
            true);
    aos = new AsnOutputStream();
    elem.encodeAll(aos);
    assertTrue(Arrays.equals(aos.toByteArray(), this.getData2()));

    Carrier carrier = new CarrierImpl(getCarrierData());
    LocationNumber locationNumber = new LocationNumberImpl();
    locationNumber.setNatureOfAddresIndicator(LocationNumber._NAI_INTERNATIONAL_NUMBER);
    locationNumber.setAddress("0000077777");
    LocationNumberCap chargeNumber = new LocationNumberCapImpl(locationNumber);
    OriginalCalledNumber originalCalledNumber =
        new OriginalCalledNumberImpl(LocationNumber._NAI_INTERNATIONAL_NUMBER, "1111188888", 0, 0);
    // int natureOfAddresIndicator, String address, int numberingPlanIndicator,
    // int addressRepresentationRestrictedIndicator
    OriginalCalledNumberCap originalCalledPartyID =
        new OriginalCalledNumberCapImpl(originalCalledNumber);
    CallingPartyNumber callingPartyNumber0 =
        new CallingPartyNumberImpl(
            LocationNumber._NAI_INTERNATIONAL_NUMBER, "2222288888", 0, 0, 0, 0);
    CallingPartyNumberCap callingPartyNumber = new CallingPartyNumberCapImpl(callingPartyNumber0);
    elem =
        new EstablishTemporaryConnectionRequestImpl(
            assistingSSPIPRoutingAddress,
            null,
            null,
            null,
            carrier,
            null,
            null,
            null,
            chargeNumber,
            originalCalledPartyID,
            callingPartyNumber,
            true);
    aos = new AsnOutputStream();
    elem.encodeAll(aos);
    assertTrue(Arrays.equals(aos.toByteArray(), this.getData3()));
  }