-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to Java: NullMultiNonBlockingTest
- Loading branch information
1 parent
636b2ff
commit 723cbc7
Showing
2 changed files
with
38 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.