DnsTest.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. // DnsTest.cs - NUnit Test Cases for the System.Net.Dns class
  2. //
  3. // Authors:
  4. // Mads Pultz ([email protected])
  5. // Martin Willemoes Hansen ([email protected])
  6. //
  7. // (C) 2001 Mads Pultz
  8. // (C) 2003 Martin Willemoes Hansen
  9. //
  10. using System;
  11. using System.Linq;
  12. using System.Net;
  13. using System.Net.Sockets;
  14. using System.Threading;
  15. using NUnit.Framework;
  16. namespace MonoTests.System.Net
  17. {
  18. [TestFixture]
  19. [Category ("InetAccess")]
  20. public class DnsTest
  21. {
  22. private String site1Name = "google-public-dns-a.google.com",
  23. site1Dot = "8.8.8.8",
  24. site2Name = "google-public-dns-b.google.com",
  25. site2Dot = "8.8.4.4",
  26. noneExistingSite = "unlikely.xamarin.com";
  27. private uint site1IP = 134744072, site2IP = 134743044; // Big-Endian
  28. [Test]
  29. #if FEATURE_NO_BSD_SOCKETS
  30. [ExpectedException (typeof (PlatformNotSupportedException))]
  31. #endif
  32. public void AsyncGetHostByName ()
  33. {
  34. IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);
  35. IPHostEntry entry = Dns.EndGetHostByName (async);
  36. SubTestValidIPHostEntry (entry);
  37. Assert.AreEqual ("google-public-dns-a.google.com", entry.HostName, "#1");
  38. }
  39. [Test]
  40. #if FEATURE_NO_BSD_SOCKETS
  41. [ExpectedException (typeof (PlatformNotSupportedException))]
  42. #endif
  43. public void AsyncGetHostByNameCallback ()
  44. {
  45. var evt = new ManualResetEvent (false);
  46. Exception ex = null;
  47. Dns.BeginGetHostByName (site1Name, new AsyncCallback ((IAsyncResult ar) =>
  48. {
  49. try {
  50. IPHostEntry h;
  51. h = Dns.EndGetHostByName (ar);
  52. SubTestValidIPHostEntry (h);
  53. } catch (Exception e) {
  54. ex = e;
  55. } finally {
  56. evt.Set ();
  57. }
  58. }), null);
  59. Assert.IsTrue (evt.WaitOne (TimeSpan.FromSeconds (60)), "Wait");
  60. Assert.IsNull (ex, "Exception");
  61. }
  62. [Test]
  63. #if FEATURE_NO_BSD_SOCKETS
  64. [ExpectedException (typeof (PlatformNotSupportedException))]
  65. #endif
  66. public void AsyncResolve ()
  67. {
  68. IAsyncResult async = Dns.BeginResolve (site1Dot, null, null);
  69. IPHostEntry entry = Dns.EndResolve (async);
  70. SubTestValidIPHostEntry (entry);
  71. var ip = GetIPv4Address (entry);
  72. Assert.AreEqual (site1Dot, ip.ToString ());
  73. }
  74. [Test]
  75. #if FEATURE_NO_BSD_SOCKETS
  76. [ExpectedException (typeof (PlatformNotSupportedException))]
  77. #endif
  78. public void AsyncResolveCallback ()
  79. {
  80. var evt = new ManualResetEvent (false);
  81. Exception ex = null;
  82. Dns.BeginResolve (site1Name, new AsyncCallback ((IAsyncResult ar) =>
  83. {
  84. try {
  85. IPHostEntry h = Dns.EndResolve (ar);
  86. SubTestValidIPHostEntry (h);
  87. } catch (Exception e) {
  88. ex = e;
  89. } finally {
  90. evt.Set ();
  91. }
  92. }), null);
  93. Assert.IsTrue (evt.WaitOne (TimeSpan.FromSeconds (60)), "Wait");
  94. Assert.IsNull (ex, "Exception");
  95. }
  96. [Test]
  97. public void BeginGetHostAddresses_HostNameOrAddress_Null ()
  98. {
  99. try {
  100. Dns.BeginGetHostAddresses (
  101. (string) null,
  102. new AsyncCallback (ShouldntBeCalled),
  103. null);
  104. Assert.Fail ("#1");
  105. } catch (ArgumentNullException ex) {
  106. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  107. Assert.IsNull (ex.InnerException, "#3");
  108. Assert.IsNotNull (ex.Message, "#4");
  109. Assert.AreEqual ("hostName", ex.ParamName, "#5");
  110. }
  111. }
  112. [Test]
  113. public void BeginGetHostAddresses_HostNameOrAddress_UnspecifiedAddress ()
  114. {
  115. // IPv4
  116. try {
  117. Dns.BeginGetHostAddresses (
  118. "0.0.0.0",
  119. new AsyncCallback (ShouldntBeCalled),
  120. null);
  121. Assert.Fail ("#A1");
  122. } catch (ArgumentException ex) {
  123. // IPv4 address 0.0.0.0 and IPv6 address ::0 are
  124. // unspecified addresses that cannot be used as
  125. // a target address
  126. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
  127. Assert.IsNull (ex.InnerException, "#A3");
  128. Assert.IsNotNull (ex.Message, "#A4");
  129. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#A5");
  130. }
  131. // IPv6
  132. try {
  133. Dns.BeginGetHostAddresses (
  134. "::0",
  135. new AsyncCallback (ShouldntBeCalled),
  136. null);
  137. Assert.Fail ("#B1");
  138. } catch (ArgumentException ex) {
  139. // IPv4 address 0.0.0.0 and IPv6 address ::0 are
  140. // unspecified addresses that cannot be used as
  141. // a target address
  142. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
  143. Assert.IsNull (ex.InnerException, "#B3");
  144. Assert.IsNotNull (ex.Message, "#B4");
  145. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#B5");
  146. }
  147. }
  148. void ShouldntBeCalled (IAsyncResult ar)
  149. {
  150. Assert.Fail ("Should not be called");
  151. }
  152. [Test]
  153. public void GetHostAddresses_HostNameOrAddress_Null ()
  154. {
  155. try {
  156. Dns.GetHostAddresses ((string) null);
  157. Assert.Fail ("#1");
  158. } catch (ArgumentNullException ex) {
  159. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  160. Assert.IsNull (ex.InnerException, "#3");
  161. Assert.IsNotNull (ex.Message, "#4");
  162. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#5");
  163. }
  164. }
  165. [Test]
  166. public void GetHostAddresses_HostNameOrAddress_UnspecifiedAddress ()
  167. {
  168. // IPv4
  169. try {
  170. Dns.GetHostAddresses ("0.0.0.0");
  171. Assert.Fail ("#A1");
  172. } catch (ArgumentException ex) {
  173. // IPv4 address 0.0.0.0 and IPv6 address ::0 are
  174. // unspecified addresses that cannot be used as
  175. // a target address
  176. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
  177. Assert.IsNull (ex.InnerException, "#A3");
  178. Assert.IsNotNull (ex.Message, "#A4");
  179. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#A5");
  180. }
  181. // IPv6
  182. try {
  183. Dns.GetHostAddresses ("::0");
  184. Assert.Fail ("#B1");
  185. } catch (ArgumentException ex) {
  186. // IPv4 address 0.0.0.0 and IPv6 address ::0 are
  187. // unspecified addresses that cannot be used as
  188. // a target address
  189. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
  190. Assert.IsNull (ex.InnerException, "#B3");
  191. Assert.IsNotNull (ex.Message, "#B4");
  192. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#B5");
  193. }
  194. }
  195. [Test]
  196. [Category("NotOnWindows")]
  197. public void GetHostAddresses_IPv6 ()
  198. {
  199. var address = Dns.GetHostAddresses("ipv6.google.com");
  200. }
  201. [Test]
  202. public void GetHostName ()
  203. {
  204. string hostName = Dns.GetHostName ();
  205. Assert.IsNotNull (hostName);
  206. }
  207. [Test]
  208. #if FEATURE_NO_BSD_SOCKETS
  209. [ExpectedException (typeof (PlatformNotSupportedException))]
  210. #endif
  211. [NUnit.Framework.Category ("AndroidNotWorking")] //Some Android devices like to return catch-all IPs for invalid host names.
  212. public void GetHostByName ()
  213. {
  214. SubTestGetHostByName (site1Name, site1Dot);
  215. SubTestGetHostByName (site2Name, site2Dot);
  216. try {
  217. var entry = Dns.GetHostByName (noneExistingSite);
  218. Assert.Fail ("Should raise a SocketException (assuming that '" + noneExistingSite + "' does not exist)");
  219. } catch (SocketException) {
  220. }
  221. }
  222. static IPAddress GetIPv4Address (IPHostEntry h)
  223. {
  224. var al = h.AddressList.FirstOrDefault (x => x.AddressFamily == AddressFamily.InterNetwork);
  225. if (al == null)
  226. Assert.Ignore ("Could not resolve an IPv4 address as required by this test case, e.g. running on an IPv6 only network");
  227. return al;
  228. }
  229. void SubTestGetHostByName (string siteName, string siteDot)
  230. {
  231. IPHostEntry h = Dns.GetHostByName (siteName);
  232. SubTestValidIPHostEntry (h);
  233. Assert.AreEqual (siteName, h.HostName, "siteName");
  234. var ip = GetIPv4Address (h);
  235. Assert.AreEqual (siteDot, ip.ToString (), "siteDot");
  236. }
  237. [Test]
  238. public void GetHostByName_HostName_Null ()
  239. {
  240. try {
  241. Dns.GetHostByName ((string) null);
  242. Assert.Fail ("#1");
  243. } catch (ArgumentNullException ex) {
  244. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  245. Assert.IsNull (ex.InnerException, "#3");
  246. Assert.IsNotNull (ex.Message, "#4");
  247. Assert.AreEqual ("hostName", ex.ParamName, "#5");
  248. }
  249. }
  250. [Test]
  251. public void GetHostByAddressString_Address_Null ()
  252. {
  253. try {
  254. Dns.GetHostByAddress ((string) null);
  255. Assert.Fail ("#1");
  256. } catch (ArgumentNullException ex) {
  257. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  258. Assert.IsNull (ex.InnerException, "#3");
  259. Assert.IsNotNull (ex.Message, "#4");
  260. Assert.AreEqual ("address", ex.ParamName, "#5");
  261. }
  262. }
  263. [Test]
  264. [ExpectedException (typeof (SocketException))]
  265. public void GetHostByAddressString2 ()
  266. {
  267. Dns.GetHostByAddress ("123.255.23");
  268. }
  269. [Test]
  270. [ExpectedException (typeof (FormatException))]
  271. public void GetHostByAddressString3 ()
  272. {
  273. Dns.GetHostByAddress ("123.256.34.10");
  274. }
  275. [Test, ExpectedException (typeof (FormatException))]
  276. public void GetHostByAddressString4 ()
  277. {
  278. Dns.GetHostByAddress ("not an IP address");
  279. }
  280. [Test]
  281. public void GetHostByAddressString5 ()
  282. {
  283. Dns.GetHostByAddress (site1Dot);
  284. }
  285. [Test]
  286. public void GetHostByAddressIPAddress_Address_Null ()
  287. {
  288. try {
  289. Dns.GetHostByAddress ((IPAddress) null);
  290. Assert.Fail ("#1");
  291. } catch (ArgumentNullException ex) {
  292. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  293. Assert.IsNull (ex.InnerException, "#3");
  294. Assert.IsNotNull (ex.Message, "#4");
  295. Assert.AreEqual ("address", ex.ParamName, "#5");
  296. }
  297. }
  298. [Test]
  299. public void GetHostByAddressIPAddress2 ()
  300. {
  301. IPAddress addr = new IPAddress (IPAddress.NetworkToHostOrder ((int) site1IP));
  302. IPHostEntry h = Dns.GetHostByAddress (addr);
  303. SubTestValidIPHostEntry (h);
  304. var ip = GetIPv4Address (h);
  305. Assert.AreEqual (addr.ToString (), ip.ToString ());
  306. }
  307. [Test]
  308. public void GetHostByAddressIPAddress3 ()
  309. {
  310. IPAddress addr = new IPAddress (IPAddress.NetworkToHostOrder ((int) site2IP));
  311. IPHostEntry h = Dns.GetHostByAddress (addr);
  312. SubTestValidIPHostEntry (h);
  313. var ip = GetIPv4Address (h);
  314. Assert.AreEqual (addr.ToString (), ip.ToString ());
  315. }
  316. [Test]
  317. #if FEATURE_NO_BSD_SOCKETS
  318. [ExpectedException (typeof (PlatformNotSupportedException))]
  319. #endif
  320. public void BeginResolve_HostName_Null ()
  321. {
  322. try {
  323. Dns.BeginResolve ((string) null,
  324. new AsyncCallback (ShouldntBeCalled),
  325. null);
  326. Assert.Fail ("#1");
  327. } catch (ArgumentNullException ex) {
  328. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  329. Assert.IsNull (ex.InnerException, "#3");
  330. Assert.IsNotNull (ex.Message, "#4");
  331. Assert.AreEqual ("hostName", ex.ParamName, "#5");
  332. }
  333. }
  334. [Test]
  335. #if FEATURE_NO_BSD_SOCKETS
  336. [ExpectedException (typeof (PlatformNotSupportedException))]
  337. #endif
  338. public void Resolve ()
  339. {
  340. SubTestResolve (site1Name);
  341. SubTestResolve (site2Name);
  342. SubTestResolve (site1Dot);
  343. SubTestResolve (site2Dot);
  344. }
  345. void SubTestResolve (string addr)
  346. {
  347. IPHostEntry h = Dns.Resolve (addr);
  348. SubTestValidIPHostEntry (h);
  349. }
  350. [Test]
  351. #if FEATURE_NO_BSD_SOCKETS
  352. [ExpectedException (typeof (PlatformNotSupportedException))]
  353. #endif
  354. public void Resolve_HostName_Null ()
  355. {
  356. try {
  357. Dns.Resolve ((string) null);
  358. Assert.Fail ("#1");
  359. } catch (ArgumentNullException ex) {
  360. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  361. Assert.IsNull (ex.InnerException, "#3");
  362. Assert.IsNotNull (ex.Message, "#4");
  363. Assert.AreEqual ("hostName", ex.ParamName, "#5");
  364. }
  365. }
  366. [Test] // BeginGetHostEntry (IPAddress, AsyncCallback, Object)
  367. #if FEATURE_NO_BSD_SOCKETS
  368. [ExpectedException (typeof (PlatformNotSupportedException))]
  369. #endif
  370. public void BeginGetHostEntry1_Address_Null ()
  371. {
  372. try {
  373. Dns.BeginGetHostEntry (
  374. (IPAddress) null,
  375. new AsyncCallback (ShouldntBeCalled),
  376. null);
  377. Assert.Fail ("#1");
  378. } catch (ArgumentNullException ex) {
  379. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  380. Assert.IsNull (ex.InnerException, "#3");
  381. Assert.IsNotNull (ex.Message, "#4");
  382. Assert.AreEqual ("address", ex.ParamName, "#5");
  383. }
  384. }
  385. [Test] // BeginGetHostEntry (String, AsyncCallback, Object)
  386. #if FEATURE_NO_BSD_SOCKETS
  387. [ExpectedException (typeof (PlatformNotSupportedException))]
  388. #endif
  389. public void BeginGetHostEntry2_HostNameOrAddress_Null ()
  390. {
  391. try {
  392. Dns.BeginGetHostEntry (
  393. (string) null,
  394. new AsyncCallback (ShouldntBeCalled),
  395. null);
  396. Assert.Fail ("#1");
  397. } catch (ArgumentNullException ex) {
  398. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  399. Assert.IsNull (ex.InnerException, "#3");
  400. Assert.IsNotNull (ex.Message, "#4");
  401. Assert.AreEqual ("hostName", ex.ParamName, "#5");
  402. }
  403. }
  404. [Test] // BeginGetHostEntry (String, AsyncCallback, Object)
  405. #if FEATURE_NO_BSD_SOCKETS
  406. [ExpectedException (typeof (PlatformNotSupportedException))]
  407. #endif
  408. public void BeginGetHostEntry2_HostNameOrAddress_UnspecifiedAddress ()
  409. {
  410. // IPv4
  411. try {
  412. Dns.BeginGetHostEntry (
  413. "0.0.0.0",
  414. new AsyncCallback (GetHostEntryCallback),
  415. null);
  416. Assert.Fail ("#1");
  417. } catch (ArgumentException ex) {
  418. // IPv4 address 0.0.0.0 and IPv6 address ::0 are
  419. // unspecified addresses that cannot be used as
  420. // a target address
  421. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
  422. Assert.IsNull (ex.InnerException, "#3");
  423. Assert.IsNotNull (ex.Message, "#4");
  424. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#5");
  425. }
  426. // IPv6
  427. try {
  428. Dns.BeginGetHostEntry (
  429. "::0",
  430. new AsyncCallback (GetHostEntryCallback),
  431. null);
  432. Assert.Fail ("#1");
  433. } catch (ArgumentException ex) {
  434. // IPv4 address 0.0.0.0 and IPv6 address ::0 are
  435. // unspecified addresses that cannot be used as
  436. // a target address
  437. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
  438. Assert.IsNull (ex.InnerException, "#3");
  439. Assert.IsNotNull (ex.Message, "#4");
  440. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#5");
  441. }
  442. }
  443. void GetHostEntryCallback (IAsyncResult ar)
  444. {
  445. IPHostEntry hostEntry = Dns.EndGetHostEntry (ar);
  446. Assert.IsNotNull (hostEntry);
  447. }
  448. [Test] // GetHostEntry (IPAddress)
  449. public void GetHostEntry1_Address_Null ()
  450. {
  451. try {
  452. Dns.GetHostEntry ((IPAddress) null);
  453. Assert.Fail ("#1");
  454. } catch (ArgumentNullException ex) {
  455. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  456. Assert.IsNull (ex.InnerException, "#3");
  457. Assert.IsNotNull (ex.Message, "#4");
  458. Assert.AreEqual ("address", ex.ParamName, "#5");
  459. }
  460. }
  461. [Test] // GetHostEntry (String)
  462. #if FEATURE_NO_BSD_SOCKETS
  463. [ExpectedException (typeof (PlatformNotSupportedException))]
  464. #endif
  465. public void GetHostEntry2 ()
  466. {
  467. Dns.GetHostEntry (site1Name); // hostname
  468. Dns.GetHostEntry (site1Dot); // IP address
  469. }
  470. [Test] // GetHostEntry (String)
  471. public void GetHostEntry2_HostNameOrAddress_Null ()
  472. {
  473. try {
  474. Dns.GetHostEntry ((string) null);
  475. Assert.Fail ("#1");
  476. } catch (ArgumentNullException ex) {
  477. Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  478. Assert.IsNull (ex.InnerException, "#3");
  479. Assert.IsNotNull (ex.Message, "#4");
  480. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#5");
  481. }
  482. }
  483. [Test] // GetHostEntry (String)
  484. public void GetHostEntry2_HostNameOrAddress_UnspecifiedAddress ()
  485. {
  486. // IPv4
  487. try {
  488. Dns.GetHostEntry ("0.0.0.0");
  489. Assert.Fail ("#A1");
  490. } catch (ArgumentException ex) {
  491. // IPv4 address 0.0.0.0 and IPv6 address ::0 are
  492. // unspecified addresses that cannot be used as
  493. // a target address
  494. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
  495. Assert.IsNull (ex.InnerException, "#A3");
  496. Assert.IsNotNull (ex.Message, "#A4");
  497. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#A5");
  498. }
  499. // IPv6
  500. try {
  501. Dns.GetHostEntry ("::0");
  502. Assert.Fail ("#B1");
  503. } catch (ArgumentException ex) {
  504. // IPv4 address 0.0.0.0 and IPv6 address ::0 are
  505. // unspecified addresses that cannot be used as
  506. // a target address
  507. Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
  508. Assert.IsNull (ex.InnerException, "#B3");
  509. Assert.IsNotNull (ex.Message, "#B4");
  510. Assert.AreEqual ("hostNameOrAddress", ex.ParamName, "#B5");
  511. }
  512. }
  513. void SubTestValidIPHostEntry (IPHostEntry h)
  514. {
  515. Assert.IsNotNull (h.HostName, "HostName not null");
  516. Assert.IsNotNull (h.AddressList, "AddressList not null");
  517. Assert.IsTrue (h.AddressList.Length > 0, "AddressList.Length");
  518. }
  519. [Test]
  520. public void GetHostEntry_StringEmpty ()
  521. {
  522. Dns.GetHostEntry ("localhost");
  523. }
  524. /* This isn't used anymore, but could be useful for debugging
  525. static void printIPHostEntry(IPHostEntry h)
  526. {
  527. Console.WriteLine("----------------------------------------------------");
  528. Console.WriteLine("Host name:");
  529. Console.WriteLine(h.HostName);
  530. Console.WriteLine("IP addresses:");
  531. IPAddress[] list = h.AddressList;
  532. for(int i = 0; i < list.Length; ++i)
  533. Console.WriteLine(list[i]);
  534. Console.WriteLine("Aliases:");
  535. string[] aliases = h.Aliases;
  536. for(int i = 0; i < aliases.Length; ++i)
  537. Console.WriteLine(aliases[i]);
  538. Console.WriteLine("----------------------------------------------------");
  539. }
  540. */
  541. }
  542. }