//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldTimeoutDueToInactivity() internal virtual void ShouldTimeoutDueToInactivity() { // given string hostname = "localhost"; int port = PortAuthority.allocatePort(); ListenSocketAddress listenSocketAddress = new ListenSocketAddress(hostname, port); _inactivityTimeoutMillis = 0; Server closingChannelServer = CatchupServer(listenSocketAddress); CatchUpClient emptyClient = emptyClient(); _lifeSupport.add(closingChannelServer); _lifeSupport.add(emptyClient); // when _lifeSupport.init(); _lifeSupport.start(); // then CatchUpClientException catchUpClientException = assertThrows(typeof(CatchUpClientException), () => emptyClient.MakeBlockingRequest(new AdvertisedSocketAddress(hostname, port), new GetStoreIdRequest(), NeverCompletingAdaptor())); assertEquals(typeof(TimeoutException), Exceptions.rootCause(catchUpClientException).GetType()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldCloseHandlerIfChannelIsClosedOnServer() internal virtual void ShouldCloseHandlerIfChannelIsClosedOnServer() { // given string hostname = "localhost"; int port = PortAuthority.allocatePort(); ListenSocketAddress listenSocketAddress = new ListenSocketAddress(hostname, port); AtomicBoolean wasClosedByServer = new AtomicBoolean(false); Server closingChannelServer = ClosingChannelCatchupServer(listenSocketAddress, wasClosedByServer); CatchUpClient emptyClient = emptyClient(); _lifeSupport.add(closingChannelServer); _lifeSupport.add(emptyClient); // when _lifeSupport.init(); _lifeSupport.start(); // then CatchUpClientException catchUpClientException = assertThrows(typeof(CatchUpClientException), () => emptyClient.MakeBlockingRequest(new AdvertisedSocketAddress(hostname, port), new GetStoreIdRequest(), NeverCompletingAdaptor())); assertEquals(typeof(ClosedChannelException), Exceptions.rootCause(catchUpClientException).GetType()); assertTrue(wasClosedByServer.get()); }