//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void serverStopsStreamingToDeadClient() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ServerStopsStreamingToDeadClient() { MadeUpServer server = _builder.server(); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); int failAtSize = FRAME_LENGTH / 1024; ClientCrashingWriter writer = new ClientCrashingWriter(client, failAtSize); try { client.FetchDataStream(writer, FRAME_LENGTH * 100); assertTrue(writer.SizeRead >= failAtSize); fail("Should fail in the middle"); } catch (ComException) { // Expected } assertTrue(writer.SizeRead >= failAtSize); long maxWaitUntil = DateTimeHelper.CurrentUnixTimeMillis() + 60_000L; while (!server.ResponseFailureEncountered() && DateTimeHelper.CurrentUnixTimeMillis() < maxWaitUntil) { sleep(100); } assertTrue("Failure writing the response should have been encountered", server.ResponseFailureEncountered()); assertFalse("Response shouldn't have been successful", server.ResponseHasBeenWritten()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void waitUntilResponseHasBeenWritten(MadeUpServer server, int maxTime) throws Exception private void WaitUntilResponseHasBeenWritten(MadeUpServer server, int maxTime) { long time = currentTimeMillis(); while (!server.ResponseHasBeenWritten() && currentTimeMillis() - time < maxTime) { Thread.Sleep(50); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void clientGetResponseFromServerViaComLayer() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ClientGetResponseFromServerViaComLayer() { MadeUpServerImplementation serverImplementation = new MadeUpServerImplementation(_storeIdToUse); MadeUpServer server = _builder.server(serverImplementation); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); int value1 = 10; int value2 = 5; Response <int> response = client.Multiply(10, 5); WaitUntilResponseHasBeenWritten(server, 1000); assertEquals(( int? )(value1 * value2), response.ResponseConflict()); assertTrue(serverImplementation.GotCalled()); assertTrue(server.ResponseHasBeenWritten()); }