1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.internal.telephony; 18 19import com.android.internal.telephony.WspTypeDecoder; 20import com.android.internal.util.HexDump; 21 22import java.io.ByteArrayOutputStream; 23import java.util.HashMap; 24import java.util.Map; 25 26import junit.framework.TestCase; 27 28public class Wap230WspContentTypeTest extends TestCase { 29 30 public static final Map<Integer, String> WELL_KNOWN_SHORT_MIME_TYPES 31 = new HashMap<Integer, String>(); 32 public static final Map<Integer, String> WELL_KNOWN_LONG_MIME_TYPES 33 = new HashMap<Integer, String>(); 34 public static final Map<Integer, String> WELL_KNOWN_PARAMETERS 35 = new HashMap<Integer, String>(); 36 37 static { 38 WELL_KNOWN_SHORT_MIME_TYPES.put(0x00, "*/*"); 39 WELL_KNOWN_SHORT_MIME_TYPES.put(0x01, "text/*"); 40 WELL_KNOWN_SHORT_MIME_TYPES.put(0x02, "text/html"); 41 WELL_KNOWN_SHORT_MIME_TYPES.put(0x03, "text/plain"); 42 WELL_KNOWN_SHORT_MIME_TYPES.put(0x04, "text/x-hdml"); 43 WELL_KNOWN_SHORT_MIME_TYPES.put(0x05, "text/x-ttml"); 44 WELL_KNOWN_SHORT_MIME_TYPES.put(0x06, "text/x-vCalendar"); 45 WELL_KNOWN_SHORT_MIME_TYPES.put(0x07, "text/x-vCard"); 46 WELL_KNOWN_SHORT_MIME_TYPES.put(0x08, "text/vnd.wap.wml"); 47 WELL_KNOWN_SHORT_MIME_TYPES.put(0x09, "text/vnd.wap.wmlscript"); 48 WELL_KNOWN_SHORT_MIME_TYPES.put(0x0A, "text/vnd.wap.wta-event"); 49 WELL_KNOWN_SHORT_MIME_TYPES.put(0x0B, "multipart/*"); 50 WELL_KNOWN_SHORT_MIME_TYPES.put(0x0C, "multipart/mixed"); 51 WELL_KNOWN_SHORT_MIME_TYPES.put(0x0D, "multipart/form-data"); 52 WELL_KNOWN_SHORT_MIME_TYPES.put(0x0E, "multipart/byterantes"); 53 WELL_KNOWN_SHORT_MIME_TYPES.put(0x0F, "multipart/alternative"); 54 WELL_KNOWN_SHORT_MIME_TYPES.put(0x10, "application/*"); 55 WELL_KNOWN_SHORT_MIME_TYPES.put(0x11, "application/java-vm"); 56 WELL_KNOWN_SHORT_MIME_TYPES.put(0x12, "application/x-www-form-urlencoded"); 57 WELL_KNOWN_SHORT_MIME_TYPES.put(0x13, "application/x-hdmlc"); 58 WELL_KNOWN_SHORT_MIME_TYPES.put(0x14, "application/vnd.wap.wmlc"); 59 WELL_KNOWN_SHORT_MIME_TYPES.put(0x15, "application/vnd.wap.wmlscriptc"); 60 WELL_KNOWN_SHORT_MIME_TYPES.put(0x16, "application/vnd.wap.wta-eventc"); 61 WELL_KNOWN_SHORT_MIME_TYPES.put(0x17, "application/vnd.wap.uaprof"); 62 WELL_KNOWN_SHORT_MIME_TYPES.put(0x18, "application/vnd.wap.wtls-ca-certificate"); 63 WELL_KNOWN_SHORT_MIME_TYPES.put(0x19, "application/vnd.wap.wtls-user-certificate"); 64 WELL_KNOWN_SHORT_MIME_TYPES.put(0x1A, "application/x-x509-ca-cert"); 65 WELL_KNOWN_SHORT_MIME_TYPES.put(0x1B, "application/x-x509-user-cert"); 66 WELL_KNOWN_SHORT_MIME_TYPES.put(0x1C, "image/*"); 67 WELL_KNOWN_SHORT_MIME_TYPES.put(0x1D, "image/gif"); 68 WELL_KNOWN_SHORT_MIME_TYPES.put(0x1E, "image/jpeg"); 69 WELL_KNOWN_SHORT_MIME_TYPES.put(0x1F, "image/tiff"); 70 WELL_KNOWN_SHORT_MIME_TYPES.put(0x20, "image/png"); 71 WELL_KNOWN_SHORT_MIME_TYPES.put(0x21, "image/vnd.wap.wbmp"); 72 WELL_KNOWN_SHORT_MIME_TYPES.put(0x22, "application/vnd.wap.multipart.*"); 73 WELL_KNOWN_SHORT_MIME_TYPES.put(0x23, "application/vnd.wap.multipart.mixed"); 74 WELL_KNOWN_SHORT_MIME_TYPES.put(0x24, "application/vnd.wap.multipart.form-data"); 75 WELL_KNOWN_SHORT_MIME_TYPES.put(0x25, "application/vnd.wap.multipart.byteranges"); 76 WELL_KNOWN_SHORT_MIME_TYPES.put(0x26, "application/vnd.wap.multipart.alternative"); 77 WELL_KNOWN_SHORT_MIME_TYPES.put(0x27, "application/xml"); 78 WELL_KNOWN_SHORT_MIME_TYPES.put(0x28, "text/xml"); 79 WELL_KNOWN_SHORT_MIME_TYPES.put(0x29, "application/vnd.wap.wbxml"); 80 WELL_KNOWN_SHORT_MIME_TYPES.put(0x2A, "application/x-x968-cross-cert"); 81 WELL_KNOWN_SHORT_MIME_TYPES.put(0x2B, "application/x-x968-ca-cert"); 82 WELL_KNOWN_SHORT_MIME_TYPES.put(0x2C, "application/x-x968-user-cert"); 83 WELL_KNOWN_SHORT_MIME_TYPES.put(0x2D, "text/vnd.wap.si"); 84 WELL_KNOWN_SHORT_MIME_TYPES.put(0x2E, "application/vnd.wap.sic"); 85 WELL_KNOWN_SHORT_MIME_TYPES.put(0x2F, "text/vnd.wap.sl"); 86 WELL_KNOWN_SHORT_MIME_TYPES.put(0x30, "application/vnd.wap.slc"); 87 WELL_KNOWN_SHORT_MIME_TYPES.put(0x31, "text/vnd.wap.co"); 88 WELL_KNOWN_SHORT_MIME_TYPES.put(0x32, "application/vnd.wap.coc"); 89 WELL_KNOWN_SHORT_MIME_TYPES.put(0x33, "application/vnd.wap.multipart.related"); 90 WELL_KNOWN_SHORT_MIME_TYPES.put(0x34, "application/vnd.wap.sia"); 91 WELL_KNOWN_SHORT_MIME_TYPES.put(0x35, "text/vnd.wap.connectivity-xml"); 92 WELL_KNOWN_SHORT_MIME_TYPES.put(0x36, "application/vnd.wap.connectivity-wbxml"); 93 WELL_KNOWN_SHORT_MIME_TYPES.put(0x37, "application/pkcs7-mime"); 94 WELL_KNOWN_SHORT_MIME_TYPES.put(0x38, "application/vnd.wap.hashed-certificate"); 95 WELL_KNOWN_SHORT_MIME_TYPES.put(0x39, "application/vnd.wap.signed-certificate"); 96 WELL_KNOWN_SHORT_MIME_TYPES.put(0x3A, "application/vnd.wap.cert-response"); 97 WELL_KNOWN_SHORT_MIME_TYPES.put(0x3B, "application/xhtml+xml"); 98 WELL_KNOWN_SHORT_MIME_TYPES.put(0x3C, "application/wml+xml"); 99 WELL_KNOWN_SHORT_MIME_TYPES.put(0x3D, "text/css"); 100 WELL_KNOWN_SHORT_MIME_TYPES.put(0x3E, "application/vnd.wap.mms-message"); 101 WELL_KNOWN_SHORT_MIME_TYPES.put(0x3F, "application/vnd.wap.rollover-certificate"); 102 WELL_KNOWN_SHORT_MIME_TYPES.put(0x40, "application/vnd.wap.locc+wbxml"); 103 WELL_KNOWN_SHORT_MIME_TYPES.put(0x41, "application/vnd.wap.loc+xml"); 104 WELL_KNOWN_SHORT_MIME_TYPES.put(0x42, "application/vnd.syncml.dm+wbxml"); 105 WELL_KNOWN_SHORT_MIME_TYPES.put(0x43, "application/vnd.syncml.dm+xml"); 106 WELL_KNOWN_SHORT_MIME_TYPES.put(0x44, "application/vnd.syncml.notification"); 107 WELL_KNOWN_SHORT_MIME_TYPES.put(0x45, "application/vnd.wap.xhtml+xml"); 108 WELL_KNOWN_SHORT_MIME_TYPES.put(0x46, "application/vnd.wv.csp.cir"); 109 WELL_KNOWN_SHORT_MIME_TYPES.put(0x47, "application/vnd.oma.dd+xml"); 110 WELL_KNOWN_SHORT_MIME_TYPES.put(0x48, "application/vnd.oma.drm.message"); 111 WELL_KNOWN_SHORT_MIME_TYPES.put(0x49, "application/vnd.oma.drm.content"); 112 WELL_KNOWN_SHORT_MIME_TYPES.put(0x4A, "application/vnd.oma.drm.rights+xml"); 113 WELL_KNOWN_SHORT_MIME_TYPES.put(0x4B, "application/vnd.oma.drm.rights+wbxml"); 114 WELL_KNOWN_SHORT_MIME_TYPES.put(0x4C, "application/vnd.wv.csp+xml"); 115 WELL_KNOWN_SHORT_MIME_TYPES.put(0x4D, "application/vnd.wv.csp+wbxml"); 116 WELL_KNOWN_SHORT_MIME_TYPES.put(0x4E, "application/vnd.syncml.ds.notification"); 117 WELL_KNOWN_SHORT_MIME_TYPES.put(0x4F, "audio/*"); 118 WELL_KNOWN_SHORT_MIME_TYPES.put(0x50, "video/*"); 119 WELL_KNOWN_SHORT_MIME_TYPES.put(0x51, "application/vnd.oma.dd2+xml"); 120 WELL_KNOWN_SHORT_MIME_TYPES.put(0x52, "application/mikey"); 121 WELL_KNOWN_SHORT_MIME_TYPES.put(0x53, "application/vnd.oma.dcd"); 122 WELL_KNOWN_SHORT_MIME_TYPES.put(0x54, "application/vnd.oma.dcdc"); 123 124 WELL_KNOWN_LONG_MIME_TYPES.put(0x0201, "application/vnd.uplanet.cacheop-wbxml"); 125 WELL_KNOWN_LONG_MIME_TYPES.put(0x0202, "application/vnd.uplanet.signal"); 126 WELL_KNOWN_LONG_MIME_TYPES.put(0x0203, "application/vnd.uplanet.alert-wbxml"); 127 WELL_KNOWN_LONG_MIME_TYPES.put(0x0204, "application/vnd.uplanet.list-wbxml"); 128 WELL_KNOWN_LONG_MIME_TYPES.put(0x0205, "application/vnd.uplanet.listcmd-wbxml"); 129 WELL_KNOWN_LONG_MIME_TYPES.put(0x0206, "application/vnd.uplanet.channel-wbxml"); 130 WELL_KNOWN_LONG_MIME_TYPES.put(0x0207, "application/vnd.uplanet.provisioning-status-uri"); 131 WELL_KNOWN_LONG_MIME_TYPES.put(0x0208, "x-wap.multipart/vnd.uplanet.header-set"); 132 WELL_KNOWN_LONG_MIME_TYPES.put(0x0209, "application/vnd.uplanet.bearer-choice-wbxml"); 133 WELL_KNOWN_LONG_MIME_TYPES.put(0x020A, "application/vnd.phonecom.mmc-wbxml"); 134 WELL_KNOWN_LONG_MIME_TYPES.put(0x020B, "application/vnd.nokia.syncset+wbxml"); 135 WELL_KNOWN_LONG_MIME_TYPES.put(0x020C, "image/x-up-wpng"); 136 WELL_KNOWN_LONG_MIME_TYPES.put(0x0300, "application/iota.mmc-wbxml"); 137 WELL_KNOWN_LONG_MIME_TYPES.put(0x0301, "application/iota.mmc-xml"); 138 WELL_KNOWN_LONG_MIME_TYPES.put(0x0302, "application/vnd.syncml+xml"); 139 WELL_KNOWN_LONG_MIME_TYPES.put(0x0303, "application/vnd.syncml+wbxml"); 140 WELL_KNOWN_LONG_MIME_TYPES.put(0x0304, "text/vnd.wap.emn+xml"); 141 WELL_KNOWN_LONG_MIME_TYPES.put(0x0305, "text/calendar"); 142 WELL_KNOWN_LONG_MIME_TYPES.put(0x0306, "application/vnd.omads-email+xml"); 143 WELL_KNOWN_LONG_MIME_TYPES.put(0x0307, "application/vnd.omads-file+xml"); 144 WELL_KNOWN_LONG_MIME_TYPES.put(0x0308, "application/vnd.omads-folder+xml"); 145 WELL_KNOWN_LONG_MIME_TYPES.put(0x0309, "text/directory;profile=vCard"); 146 WELL_KNOWN_LONG_MIME_TYPES.put(0x030A, "application/vnd.wap.emn+wbxml"); 147 WELL_KNOWN_LONG_MIME_TYPES.put(0x030B, "application/vnd.nokia.ipdc-purchase-response"); 148 WELL_KNOWN_LONG_MIME_TYPES.put(0x030C, "application/vnd.motorola.screen3+xml"); 149 WELL_KNOWN_LONG_MIME_TYPES.put(0x030D, "application/vnd.motorola.screen3+gzip"); 150 WELL_KNOWN_LONG_MIME_TYPES.put(0x030E, "application/vnd.cmcc.setting+wbxml"); 151 WELL_KNOWN_LONG_MIME_TYPES.put(0x030F, "application/vnd.cmcc.bombing+wbxml"); 152 WELL_KNOWN_LONG_MIME_TYPES.put(0x0310, "application/vnd.docomo.pf"); 153 WELL_KNOWN_LONG_MIME_TYPES.put(0x0311, "application/vnd.docomo.ub"); 154 WELL_KNOWN_LONG_MIME_TYPES.put(0x0312, "application/vnd.omaloc-supl-init"); 155 WELL_KNOWN_LONG_MIME_TYPES.put(0x0313, "application/vnd.oma.group-usage-list+xml"); 156 WELL_KNOWN_LONG_MIME_TYPES.put(0x0314, "application/oma-directory+xml"); 157 WELL_KNOWN_LONG_MIME_TYPES.put(0x0315, "application/vnd.docomo.pf2"); 158 WELL_KNOWN_LONG_MIME_TYPES.put(0x0316, "application/vnd.oma.drm.roap-trigger+wbxml"); 159 WELL_KNOWN_LONG_MIME_TYPES.put(0x0317, "application/vnd.sbm.mid2"); 160 WELL_KNOWN_LONG_MIME_TYPES.put(0x0318, "application/vnd.wmf.bootstrap"); 161 WELL_KNOWN_LONG_MIME_TYPES.put(0x0319, "application/vnc.cmcc.dcd+xml"); 162 WELL_KNOWN_LONG_MIME_TYPES.put(0x031A, "application/vnd.sbm.cid"); 163 WELL_KNOWN_LONG_MIME_TYPES.put(0x031B, "application/vnd.oma.bcast.provisioningtrigger"); 164 165 WELL_KNOWN_PARAMETERS.put(0x00, "Q"); 166 WELL_KNOWN_PARAMETERS.put(0x01, "Charset"); 167 WELL_KNOWN_PARAMETERS.put(0x02, "Level"); 168 WELL_KNOWN_PARAMETERS.put(0x03, "Type"); 169 WELL_KNOWN_PARAMETERS.put(0x07, "Differences"); 170 WELL_KNOWN_PARAMETERS.put(0x08, "Padding"); 171 WELL_KNOWN_PARAMETERS.put(0x09, "Type"); 172 WELL_KNOWN_PARAMETERS.put(0x0E, "Max-Age"); 173 WELL_KNOWN_PARAMETERS.put(0x10, "Secure"); 174 WELL_KNOWN_PARAMETERS.put(0x11, "SEC"); 175 WELL_KNOWN_PARAMETERS.put(0x12, "MAC"); 176 WELL_KNOWN_PARAMETERS.put(0x13, "Creation-date"); 177 WELL_KNOWN_PARAMETERS.put(0x14, "Modification-date"); 178 WELL_KNOWN_PARAMETERS.put(0x15, "Read-date"); 179 WELL_KNOWN_PARAMETERS.put(0x16, "Size"); 180 WELL_KNOWN_PARAMETERS.put(0x17, "Name"); 181 WELL_KNOWN_PARAMETERS.put(0x18, "Filename"); 182 WELL_KNOWN_PARAMETERS.put(0x19, "Start"); 183 WELL_KNOWN_PARAMETERS.put(0x1A, "Start-info"); 184 WELL_KNOWN_PARAMETERS.put(0x1B, "Comment"); 185 WELL_KNOWN_PARAMETERS.put(0x1C, "Domain"); 186 WELL_KNOWN_PARAMETERS.put(0x1D, "Path"); 187 188 } 189 190 final int WSP_DEFINED_SHORT_MIME_TYPE_COUNT = 85; 191 final int WSP_DEFINED_LONG_MIME_TYPE_COUNT = 85; 192 193 private static final byte WSP_STRING_TERMINATOR = 0x00; 194 private static final byte WSP_SHORT_INTEGER_MASK = (byte) 0x80; 195 private static final byte WSP_LENGTH_QUOTE = 0x1F; 196 private static final byte WSP_QUOTE = 0x22; 197 198 private static final short LONG_MIME_TYPE_OMA_DIRECTORY_XML = 0x0314; 199 private static final short LONG_MIME_TYPE_UNASSIGNED = 0x052C; 200 201 private static final byte SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE = 0x3F; 202 private static final byte SHORT_MIME_TYPE_UNASSIGNED = 0x60; 203 204 private static final String STRING_MIME_TYPE_ROLLOVER_CERTIFICATE 205 = "application/vnd.wap.rollover-certificate"; 206 207 private static final byte TYPED_PARAM_Q = 0x00; 208 private static final byte TYPED_PARAM_DOMAIN = 0x1C; 209 private static final byte PARAM_UNASSIGNED = 0x42; 210 private static final byte PARAM_NO_VALUE = 0x00; 211 private static final byte TYPED_PARAM_SEC = 0x11; 212 private static final byte TYPED_PARAM_MAC = 0x12; 213 214 public void testHasExpectedNumberOfShortMimeTypes() { 215 assertEquals(WSP_DEFINED_SHORT_MIME_TYPE_COUNT, WELL_KNOWN_SHORT_MIME_TYPES.size()); 216 } 217 218 public void testHasExpectedNumberOfLongMimeTypes() { 219 assertEquals(WSP_DEFINED_LONG_MIME_TYPE_COUNT, WELL_KNOWN_LONG_MIME_TYPES.size()); 220 } 221 222 public void testWellKnownShortIntegerMimeTypeValues() { 223 224 for (int value : Wap230WspContentTypeTest.WELL_KNOWN_SHORT_MIME_TYPES.keySet()) { 225 WspTypeDecoder unit = new WspTypeDecoder( 226 HexDump.toByteArray((byte) (value | WSP_SHORT_INTEGER_MASK))); 227 assertTrue(unit.decodeContentType(0)); 228 String mimeType = unit.getValueString(); 229 int wellKnownValue = (int) unit.getValue32(); 230 assertEquals(Wap230WspContentTypeTest.WELL_KNOWN_SHORT_MIME_TYPES.get(value), mimeType); 231 assertEquals(value, wellKnownValue); 232 assertEquals(1, unit.getDecodedDataLength()); 233 } 234 } 235 236 public void testWellKnownLongIntegerMimeTypeValues() { 237 byte headerLength = 3; 238 byte typeLength = 2; 239 for (int value : Wap230WspContentTypeTest.WELL_KNOWN_SHORT_MIME_TYPES.keySet()) { 240 byte[] data = new byte[10]; 241 data[0] = headerLength; 242 data[1] = typeLength; 243 data[2] = (byte) (value >> 8); 244 data[3] = (byte) (value & 0xFF); 245 WspTypeDecoder unit = new WspTypeDecoder(data); 246 assertTrue(unit.decodeContentType(0)); 247 String mimeType = unit.getValueString(); 248 int wellKnownValue = (int) unit.getValue32(); 249 assertEquals(Wap230WspContentTypeTest.WELL_KNOWN_SHORT_MIME_TYPES.get(value), mimeType); 250 assertEquals(value, wellKnownValue); 251 assertEquals(4, unit.getDecodedDataLength()); 252 } 253 } 254 255 public void testDecodeReturnsFalse_WhenOnlyAZeroBytePresent() { 256 257 ByteArrayOutputStream out = new ByteArrayOutputStream(); 258 out.write(0x00); 259 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 260 assertFalse(unit.decodeContentType(0)); 261 } 262 263 public void testConstrainedMediaExtensionMedia() throws Exception { 264 265 String testType = "application/wibble"; 266 ByteArrayOutputStream out = new ByteArrayOutputStream(); 267 out.write(testType.getBytes("US-ASCII")); 268 out.write(WSP_STRING_TERMINATOR); 269 270 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 271 assertTrue(unit.decodeContentType(0)); 272 String mimeType = unit.getValueString(); 273 assertEquals(testType, mimeType); 274 assertEquals(-1, unit.getValue32()); 275 assertEquals(19, unit.getDecodedDataLength()); 276 } 277 278 public void testGeneralFormShortLengthExtensionMedia() throws Exception { 279 280 String testType = "12345678901234567890123456789"; 281 ByteArrayOutputStream out = new ByteArrayOutputStream(); 282 out.write(testType.length() + 1); 283 out.write(testType.getBytes("US-ASCII")); 284 out.write(WSP_STRING_TERMINATOR); 285 286 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 287 assertTrue(unit.decodeContentType(0)); 288 289 String mimeType = unit.getValueString(); 290 assertEquals(testType, mimeType); 291 assertEquals(-1, unit.getValue32()); 292 assertEquals(31, unit.getDecodedDataLength()); 293 } 294 295 public void testGeneralFormShortLengthWellKnownShortInteger() { 296 297 ByteArrayOutputStream out = new ByteArrayOutputStream(); 298 out.write(0x01); 299 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 300 301 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 302 assertTrue(unit.decodeContentType(0)); 303 304 String mimeType = unit.getValueString(); 305 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 306 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 307 assertEquals(2, unit.getDecodedDataLength()); 308 309 } 310 311 public void testGeneralFormShortLengthWellKnownShortIntegerWithUnknownValue() { 312 313 ByteArrayOutputStream out = new ByteArrayOutputStream(); 314 out.write(0x01); 315 out.write(SHORT_MIME_TYPE_UNASSIGNED | WSP_SHORT_INTEGER_MASK); 316 317 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 318 assertTrue(unit.decodeContentType(0)); 319 320 String mimeType = unit.getValueString(); 321 assertNull(mimeType); 322 assertEquals(SHORT_MIME_TYPE_UNASSIGNED, unit.getValue32()); 323 assertEquals(2, unit.getDecodedDataLength()); 324 325 } 326 327 public void testGeneralFormShortLengthWellKnownLongInteger() { 328 329 ByteArrayOutputStream out = new ByteArrayOutputStream(); 330 331 out.write(0x03); // header length 332 out.write(0x02); // type length (2 octets) 333 out.write(LONG_MIME_TYPE_OMA_DIRECTORY_XML >> 8); 334 out.write(LONG_MIME_TYPE_OMA_DIRECTORY_XML & 0xFF); 335 336 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 337 assertTrue(unit.decodeContentType(0)); 338 339 String mimeType = unit.getValueString(); 340 341 assertEquals("application/oma-directory+xml", mimeType); 342 assertEquals(LONG_MIME_TYPE_OMA_DIRECTORY_XML, unit.getValue32()); 343 assertEquals(4, unit.getDecodedDataLength()); 344 } 345 346 public void testGeneralFormShortLengthWellKnownLongIntegerWithUnknownValue() { 347 348 ByteArrayOutputStream out = new ByteArrayOutputStream(); 349 350 out.write(0x03); // Value-length, short-length 351 out.write(0x02); // long-integer length (2 octets) 352 out.write(LONG_MIME_TYPE_UNASSIGNED >> 8); 353 out.write(LONG_MIME_TYPE_UNASSIGNED & 0xFF); 354 355 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 356 assertTrue(unit.decodeContentType(0)); 357 358 String mimeType = unit.getValueString(); 359 360 assertNull(mimeType); 361 assertEquals(LONG_MIME_TYPE_UNASSIGNED, unit.getValue32()); 362 assertEquals(4, unit.getDecodedDataLength()); 363 364 } 365 366 public void testGeneralFormLengthQuoteWellKnownShortInteger() { 367 368 ByteArrayOutputStream out = new ByteArrayOutputStream(); 369 370 out.write(WSP_LENGTH_QUOTE); 371 out.write(0x01); // Length as UINTVAR 372 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 373 374 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 375 assertTrue(unit.decodeContentType(0)); 376 377 String mimeType = unit.getValueString(); 378 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 379 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 380 assertEquals(3, unit.getDecodedDataLength()); 381 382 } 383 384 public void testGeneralFormLengthQuoteWellKnownShortIntegerWithUnknownValue() { 385 386 ByteArrayOutputStream out = new ByteArrayOutputStream(); 387 388 out.write(WSP_LENGTH_QUOTE); 389 out.write(0x01); // Length as UINTVAR 390 out.write(SHORT_MIME_TYPE_UNASSIGNED | WSP_SHORT_INTEGER_MASK); 391 392 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 393 assertTrue(unit.decodeContentType(0)); 394 395 String mimeType = unit.getValueString(); 396 assertNull(mimeType); 397 assertEquals(SHORT_MIME_TYPE_UNASSIGNED, unit.getValue32()); 398 assertEquals(3, unit.getDecodedDataLength()); 399 } 400 401 public void testGeneralFormLengthQuoteWellKnownLongInteger() { 402 403 ByteArrayOutputStream out = new ByteArrayOutputStream(); 404 405 out.write(WSP_LENGTH_QUOTE); 406 out.write(0x03); // Length as UINTVAR 407 out.write(0x02); // long-integer length (2 octets) 408 out.write(LONG_MIME_TYPE_OMA_DIRECTORY_XML >> 8); 409 out.write(LONG_MIME_TYPE_OMA_DIRECTORY_XML & 0xFF); 410 411 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 412 assertTrue(unit.decodeContentType(0)); 413 414 String mimeType = unit.getValueString(); 415 416 assertEquals("application/oma-directory+xml", mimeType); 417 assertEquals(LONG_MIME_TYPE_OMA_DIRECTORY_XML, unit.getValue32()); 418 assertEquals(5, unit.getDecodedDataLength()); 419 420 } 421 422 public void testGeneralFormLengthQuoteWellKnownLongIntegerWithUnknownValue() { 423 424 ByteArrayOutputStream out = new ByteArrayOutputStream(); 425 426 out.write(WSP_LENGTH_QUOTE); 427 out.write(0x03); // Length as UINTVAR 428 out.write(0x02); // long-integer length (2 octets) 429 out.write(LONG_MIME_TYPE_UNASSIGNED >> 8); 430 out.write(LONG_MIME_TYPE_UNASSIGNED & 0xFF); 431 432 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 433 assertTrue(unit.decodeContentType(0)); 434 435 String mimeType = unit.getValueString(); 436 437 assertNull(mimeType); 438 assertEquals(LONG_MIME_TYPE_UNASSIGNED, unit.getValue32()); 439 assertEquals(5, unit.getDecodedDataLength()); 440 441 } 442 443 public void testGeneralFormLengthQuoteExtensionMedia() throws Exception { 444 445 String testType = "application/wibble"; 446 ByteArrayOutputStream out = new ByteArrayOutputStream(); 447 448 out.write(WSP_LENGTH_QUOTE); 449 out.write(testType.length() + 1); // Length as UINTVAR 450 451 out.write(testType.getBytes("US-ASCII")); 452 out.write(WSP_STRING_TERMINATOR); 453 454 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 455 assertTrue(unit.decodeContentType(0)); 456 457 String mimeType = unit.getValueString(); 458 459 assertEquals(testType, mimeType); 460 assertEquals(-1, unit.getValue32()); 461 assertEquals(21, unit.getDecodedDataLength()); 462 463 } 464 465 public void testGeneralFormLengthQuoteExtensionMediaWithNiceLongMimeType() throws Exception { 466 467 String testType = 468 "01234567890123456789012345678901234567890123456789012345678901234567890123456789" 469 +"01234567890123456789012345678901234567890123456789012345678901234567890123456789"; 470 ByteArrayOutputStream out = new ByteArrayOutputStream(); 471 472 out.write(WSP_LENGTH_QUOTE); 473 out.write(0x81); // Length as UINTVAR (161 decimal, 0xA1), 2 bytes 474 out.write(0x21); 475 476 out.write(testType.getBytes("US-ASCII")); 477 out.write(WSP_STRING_TERMINATOR); 478 479 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 480 assertTrue(unit.decodeContentType(0)); 481 482 String mimeType = unit.getValueString(); 483 484 assertEquals(testType, mimeType); 485 assertEquals(-1, unit.getValue32()); 486 assertEquals(164, unit.getDecodedDataLength()); 487 488 } 489 490 public void testConstrainedMediaExtensionMediaWithSpace() throws Exception { 491 492 String testType = " application/wibble"; 493 ByteArrayOutputStream out = new ByteArrayOutputStream(); 494 out.write(testType.getBytes("US-ASCII")); 495 out.write(WSP_STRING_TERMINATOR); 496 497 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 498 assertTrue(unit.decodeContentType(0)); 499 500 String mimeType = unit.getValueString(); 501 502 assertEquals(testType, mimeType); 503 assertEquals(-1, unit.getValue32()); 504 assertEquals(20, unit.getDecodedDataLength()); 505 506 } 507 508 public void testTypedParamWellKnownShortIntegerNoValue() { 509 510 ByteArrayOutputStream out = new ByteArrayOutputStream(); 511 out.write(0x03); // Value-length, short-length 512 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 513 out.write(TYPED_PARAM_DOMAIN | WSP_SHORT_INTEGER_MASK); 514 out.write(PARAM_NO_VALUE); 515 516 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 517 assertTrue(unit.decodeContentType(0)); 518 519 String mimeType = unit.getValueString(); 520 521 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 522 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 523 524 assertEquals(4, unit.getDecodedDataLength()); 525 526 Map<String, String> params = unit.getContentParameters(); 527 assertEquals(null, params.get("Domain")); 528 529 } 530 531 public void testTypedParamWellKnownShortIntegerTokenText() throws Exception { 532 533 ByteArrayOutputStream out = new ByteArrayOutputStream(); 534 out.write(0x14); // Value-length, short-length 535 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 536 out.write(TYPED_PARAM_DOMAIN | WSP_SHORT_INTEGER_MASK); 537 out.write("wdstechnology.com".getBytes("US-ASCII")); 538 out.write(WSP_STRING_TERMINATOR); 539 540 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 541 assertTrue(unit.decodeContentType(0)); 542 543 String mimeType = unit.getValueString(); 544 545 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 546 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 547 548 assertEquals(out.toByteArray().length, unit.getDecodedDataLength()); 549 550 Map<String, String> params = unit.getContentParameters(); 551 assertEquals("wdstechnology.com", params.get("Domain")); 552 553 } 554 555 public void testTypedParamWellKnownLongIntegerTokenText() throws Exception { 556 557 ByteArrayOutputStream out = new ByteArrayOutputStream(); 558 out.write(0x15); 559 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 560 out.write(0x01); 561 out.write(TYPED_PARAM_DOMAIN); 562 out.write("wdstechnology.com".getBytes("US-ASCII")); 563 out.write(WSP_STRING_TERMINATOR); 564 565 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 566 assertTrue(unit.decodeContentType(0)); 567 568 String mimeType = unit.getValueString(); 569 570 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 571 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 572 573 assertEquals(22, unit.getDecodedDataLength()); 574 575 Map<String, String> params = unit.getContentParameters(); 576 assertEquals("wdstechnology.com", params.get("Domain")); 577 578 } 579 580 public void testTypedParamWellKnownShortIntegerQuotedText() throws Exception { 581 582 ByteArrayOutputStream out = new ByteArrayOutputStream(); 583 out.write(0x15); 584 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 585 out.write(TYPED_PARAM_DOMAIN | WSP_SHORT_INTEGER_MASK); 586 out.write(WSP_QUOTE); 587 out.write("wdstechnology.com".getBytes("US-ASCII")); 588 out.write(WSP_STRING_TERMINATOR); 589 590 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 591 assertTrue(unit.decodeContentType(0)); 592 593 String mimeType = unit.getValueString(); 594 595 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 596 assertEquals(0x3F, unit.getValue32()); 597 assertEquals(22, unit.getDecodedDataLength()); 598 599 Map<String, String> params = unit.getContentParameters(); 600 assertEquals("wdstechnology.com", params.get("Domain")); 601 602 } 603 604 public void testTypedParamWellKnownShortIntegerCompactIntegerValue() { 605 606 ByteArrayOutputStream out = new ByteArrayOutputStream(); 607 out.write(0x3); 608 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 609 out.write(TYPED_PARAM_SEC | WSP_SHORT_INTEGER_MASK); 610 out.write(0x01 | WSP_SHORT_INTEGER_MASK); 611 612 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 613 assertTrue(unit.decodeContentType(0)); 614 615 String mimeType = unit.getValueString(); 616 617 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 618 assertEquals(0x3F, unit.getValue32()); 619 assertEquals(4, unit.getDecodedDataLength()); 620 621 Map<String, String> params = unit.getContentParameters(); 622 assertEquals("1", params.get("SEC")); 623 624 } 625 626 public void testTypedParamWellKnownShortIntegerMultipleParameters() throws Exception { 627 628 ByteArrayOutputStream out = new ByteArrayOutputStream(); 629 out.write(0x0B); 630 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 631 out.write(TYPED_PARAM_SEC | WSP_SHORT_INTEGER_MASK); 632 out.write(0x01 | WSP_SHORT_INTEGER_MASK); 633 out.write(TYPED_PARAM_MAC | WSP_SHORT_INTEGER_MASK); 634 out.write(WSP_QUOTE); 635 out.write("imapc".getBytes("US-ASCII")); 636 out.write(WSP_STRING_TERMINATOR); 637 638 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 639 assertTrue(unit.decodeContentType(0)); 640 641 String mimeType = unit.getValueString(); 642 643 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 644 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 645 assertEquals(12, unit.getDecodedDataLength()); 646 647 Map<String, String> params = unit.getContentParameters(); 648 assertEquals("1", params.get("SEC")); 649 assertEquals("imapc", params.get("MAC")); 650 } 651 652 public void testUntypedParamIntegerValueShortInteger() throws Exception { 653 ByteArrayOutputStream out = new ByteArrayOutputStream(); 654 out.write(0x0A); 655 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 656 out.write("MYPARAM".getBytes("US-ASCII")); 657 out.write(WSP_STRING_TERMINATOR); // EOS 658 out.write(0x45 | WSP_SHORT_INTEGER_MASK); 659 660 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 661 assertTrue(unit.decodeContentType(0)); 662 663 String mimeType = unit.getValueString(); 664 665 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 666 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 667 assertEquals(11, unit.getDecodedDataLength()); 668 669 Map<String, String> params = unit.getContentParameters(); 670 assertEquals("69", params.get("MYPARAM")); 671 } 672 673 public void testUntypedParamIntegerValueLongInteger() throws Exception { 674 ByteArrayOutputStream out = new ByteArrayOutputStream(); 675 out.write(0x0C); 676 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 677 out.write("MYPARAM".getBytes("US-ASCII")); 678 out.write(WSP_STRING_TERMINATOR); 679 out.write(0x02); // Short Length 680 out.write(0x42); // Long Integer byte 1 681 out.write(0x69); // Long Integer byte 2 682 683 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 684 assertTrue(unit.decodeContentType(0)); 685 686 String mimeType = unit.getValueString(); 687 688 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 689 assertEquals(0x3F, unit.getValue32()); 690 assertEquals(13, unit.getDecodedDataLength()); 691 692 Map<String, String> params = unit.getContentParameters(); 693 assertEquals("17001", params.get("MYPARAM")); 694 } 695 696 public void testUntypedParamTextNoValue() throws Exception { 697 ByteArrayOutputStream out = new ByteArrayOutputStream(); 698 out.write(0x0A); 699 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 700 out.write("MYPARAM".getBytes("US-ASCII")); 701 out.write(WSP_STRING_TERMINATOR); 702 out.write(PARAM_NO_VALUE); 703 704 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 705 assertTrue(unit.decodeContentType(0)); 706 String mimeType = unit.getValueString(); 707 708 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 709 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 710 assertEquals(11, unit.getDecodedDataLength()); 711 712 Map<String, String> params = unit.getContentParameters(); 713 assertEquals(null, params.get("MYPARAM")); 714 715 } 716 717 public void testUntypedParamTextTokenText() throws Exception { 718 ByteArrayOutputStream out = new ByteArrayOutputStream(); 719 out.write(0x11); 720 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 721 out.write("MYPARAM".getBytes("US-ASCII")); 722 out.write(WSP_STRING_TERMINATOR); 723 out.write("myvalue".getBytes("US-ASCII")); 724 out.write(WSP_STRING_TERMINATOR); 725 726 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 727 assertTrue(unit.decodeContentType(0)); 728 String mimeType = unit.getValueString(); 729 730 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 731 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 732 assertEquals(18, unit.getDecodedDataLength()); 733 734 Map<String, String> params = unit.getContentParameters(); 735 assertEquals("myvalue", params.get("MYPARAM")); 736 } 737 738 public void testUntypedParamTextQuotedString() throws Exception { 739 ByteArrayOutputStream out = new ByteArrayOutputStream(); 740 out.write(0x11); 741 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 742 out.write("MYPARAM".getBytes("US-ASCII")); 743 out.write(WSP_STRING_TERMINATOR); 744 out.write(WSP_QUOTE); 745 out.write("myvalue".getBytes("US-ASCII")); 746 out.write(WSP_STRING_TERMINATOR); 747 748 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 749 assertTrue(unit.decodeContentType(0)); 750 String mimeType = unit.getValueString(); 751 752 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 753 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 754 assertEquals(19, unit.getDecodedDataLength()); 755 756 Map<String, String> params = unit.getContentParameters(); 757 assertEquals("myvalue", params.get("MYPARAM")); 758 759 } 760 761 public void testDecodesReturnsFalse_ForParamWithMissingValue() throws Exception { 762 ByteArrayOutputStream out = new ByteArrayOutputStream(); 763 out.write(0x09); 764 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 765 out.write("MYPARAM".getBytes("US-ASCII")); 766 out.write(WSP_STRING_TERMINATOR); 767 768 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 769 assertFalse(unit.decodeContentType(0)); 770 } 771 772 public void testTypedParamTextQValue() { 773 ByteArrayOutputStream out = new ByteArrayOutputStream(); 774 out.write(0x04); 775 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 776 out.write(TYPED_PARAM_Q); 777 out.write(0x83); // Q value byte 1 778 out.write(0x31); // Q value byte 2 779 780 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 781 assertTrue(unit.decodeContentType(0)); 782 String mimeType = unit.getValueString(); 783 784 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 785 assertEquals(0x3F, unit.getValue32()); 786 assertEquals(5, unit.getDecodedDataLength()); 787 788 Map<String, String> params = unit.getContentParameters(); 789 assertEquals("433", params.get("Q")); 790 791 } 792 793 public void testTypedParamUnassignedWellKnownShortIntegerTokenText() throws Exception { 794 795 ByteArrayOutputStream out = new ByteArrayOutputStream(); 796 out.write(0x14); 797 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 798 out.write(PARAM_UNASSIGNED | WSP_SHORT_INTEGER_MASK); 799 out.write("wdstechnology.com".getBytes("US-ASCII")); 800 out.write(WSP_STRING_TERMINATOR); 801 802 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 803 assertTrue(unit.decodeContentType(0)); 804 805 String mimeType = unit.getValueString(); 806 807 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 808 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 809 810 assertEquals(21, unit.getDecodedDataLength()); 811 812 Map<String, String> params = unit.getContentParameters(); 813 assertEquals("wdstechnology.com", params.get("unassigned/0x42")); 814 815 } 816 817 public void testTypedParamUnassignedWellKnownLongIntegerTokenText() throws Exception { 818 819 ByteArrayOutputStream out = new ByteArrayOutputStream(); 820 out.write(0x15); 821 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 822 out.write(0x01); // Short-length of well-known parameter token 823 out.write(PARAM_UNASSIGNED); 824 out.write("wdstechnology.com".getBytes("US-ASCII")); 825 out.write(WSP_STRING_TERMINATOR); 826 827 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 828 assertTrue(unit.decodeContentType(0)); 829 830 String mimeType = unit.getValueString(); 831 832 assertEquals(STRING_MIME_TYPE_ROLLOVER_CERTIFICATE, mimeType); 833 assertEquals(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE, unit.getValue32()); 834 835 assertEquals(22, unit.getDecodedDataLength()); 836 837 Map<String, String> params = unit.getContentParameters(); 838 assertEquals("wdstechnology.com", params.get("unassigned/0x42")); 839 } 840 841 public void testDecodesReturnsFalse_WhenParamValueNotTerminated() throws Exception { 842 843 ByteArrayOutputStream out = new ByteArrayOutputStream(); 844 out.write(0x15); 845 out.write(SHORT_MIME_TYPE_ROLLOVER_CERTIFICATE | WSP_SHORT_INTEGER_MASK); 846 out.write(0x01); 847 out.write(PARAM_UNASSIGNED); 848 out.write("wdstechnology.com".getBytes("US-ASCII")); 849 850 WspTypeDecoder unit = new WspTypeDecoder(out.toByteArray()); 851 assertFalse(unit.decodeContentType(0)); 852 } 853}