//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 TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void makeSureClientCanStreamBigData() public virtual void MakeSureClientCanStreamBigData() { MadeUpServer server = _builder.server(); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); client.FetchDataStream(new ToAssertionWriter(), FRAME_LENGTH * 3); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void clientCanReadChunkSizeBiggerThanItsOwn() public virtual void ClientCanReadChunkSizeBiggerThanItsOwn() { // Given that frameLength is the same for both client and server. int serverChunkSize = 20000; int clientChunkSize = serverChunkSize / 10; MadeUpServer server = _builder.chunkSize(serverChunkSize).server(); MadeUpClient client = _builder.chunkSize(clientChunkSize).client(); AddToLifeAndStart(server, client); // Tell server to stream data occupying roughly two chunks. The chunks // from server are 10 times bigger than the clients chunk size. client.FetchDataStream(new ToAssertionWriter(), serverChunkSize * 2); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void communicateBetweenJvms() public virtual void CommunicateBetweenJvms() { ServerInterface server = _builder.serverInOtherJvm(_port); server.AwaitStarted(); MadeUpClient client = _builder.port(_port).client(); _life.add(client); _life.start(); assertEquals(( int? )(9 * 5), client.Multiply(9, 5).response()); client.FetchDataStream(new ToAssertionWriter(), 1024 * 1024 * 3); server.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void clientThrowsServerSideErrorMidwayThroughStreaming() public virtual void ClientThrowsServerSideErrorMidwayThroughStreaming() { const string failureMessage = "Just failing"; MadeUpServerImplementation serverImplementation = new MadeUpServerImplementationAnonymousInnerClass(this, _storeIdToUse, failureMessage); MadeUpServer server = _builder.server(serverImplementation); MadeUpClient client = _builder.client(); AddToLifeAndStart(server, client); try { client.FetchDataStream(new ToAssertionWriter(), FRAME_LENGTH * 2); fail("Should have thrown " + typeof(MadeUpException).Name); } catch (MadeUpException e) { assertEquals(failureMessage, e.Message); } }