Skip to content

Commit

Permalink
Migrate to Java: NullMultiNonBlockingTest
Browse files Browse the repository at this point in the history
  • Loading branch information
marianobarrios committed Mar 31, 2024
1 parent 636b2ff commit 723cbc7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 32 deletions.
38 changes: 38 additions & 0 deletions src/test/scala/tlschannel/NullMultiNonBlockingTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package tlschannel;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import scala.Option;
import scala.collection.immutable.Seq;
import tlschannel.helpers.NonBlockingLoops;
import tlschannel.helpers.SocketPair;
import tlschannel.helpers.SocketPairFactory;
import tlschannel.helpers.SslContextFactory;

/** Test using concurrent, non-blocking connections, and a "null" [[javax.net.ssl.SSLEngine]] that just passes all byte
* as they are.
*/
@TestInstance(Lifecycle.PER_CLASS)
public class NullMultiNonBlockingTest {

private final SslContextFactory sslContextFactory = new SslContextFactory();
private final SocketPairFactory factory = new SocketPairFactory(sslContextFactory.defaultContext());
private final int dataSize = 10 * 1024 * 1024;
private final int totalConnections = 50;

@Test
public void testRunTasksInNonBlockingLoop() {
Seq<SocketPair> pairs =
factory.nioNioN(null, totalConnections, Option.apply(null), true, false, Option.apply(null));
NonBlockingLoops.Report report = NonBlockingLoops.loop(pairs, dataSize, false);
Assertions.assertEquals(0, report.asyncTasksRun());
}

@AfterAll
public void afterAll() {
System.out.println(factory.getGlobalAllocationReport());
}
}
32 changes: 0 additions & 32 deletions src/test/scala/tlschannel/NullMultiNonBlockingTest.scala

This file was deleted.

0 comments on commit 723cbc7

Please sign in to comment.