Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions benchmark/script/generate-certs.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@
import com.eatthepath.pushy.apns.util.ApnsPayloadBuilder;
import com.eatthepath.pushy.apns.util.SimpleApnsPushNotification;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.pkitesting.CertificateBuilder;
import io.netty.pkitesting.X509Bundle;
import io.netty.util.concurrent.Future;
import org.apache.commons.lang3.RandomStringUtils;
import org.openjdk.jmh.annotations.*;

import java.security.KeyPairGenerator;
import java.security.SecureRandom;
import java.security.interfaces.ECPrivateKey;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand All @@ -57,9 +61,8 @@ public class ApnsClientBenchmark {
@Param({"1", "4", "8"})
public int concurrentConnections;

private static final String CA_CERTIFICATE_FILENAME = "/ca.pem";
private static final String SERVER_CERTIFICATES_FILENAME = "/server_certs.pem";
private static final String SERVER_KEY_FILENAME = "/server_key.pem";
protected static X509Bundle CA_BUNDLE;
protected static X509Bundle SERVER_CERTIFICATE_BUNDLE;

private static final String TOPIC = "com.eatthepath.pushy";
private static final String TEAM_ID = "benchmark.team";
Expand All @@ -77,6 +80,27 @@ public void setUp() throws Exception {
this.clientResources = new ApnsClientResources(new NioEventLoopGroup(this.concurrentConnections));
this.serverEventLoopGroup = new NioEventLoopGroup(this.concurrentConnections);

final Instant now = Instant.now();

final CertificateBuilder rootCertificateBuilderTemplate = new CertificateBuilder()
.notBefore(now)
.notAfter(now.plus(Duration.ofHours(8)));

CA_BUNDLE = rootCertificateBuilderTemplate.copy()
.subject("CN=PushyTestRoot")
.setKeyUsage(true, CertificateBuilder.KeyUsage.digitalSignature, CertificateBuilder.KeyUsage.keyCertSign)
.setIsCertificateAuthority(true)
.buildSelfSigned();

SERVER_CERTIFICATE_BUNDLE = rootCertificateBuilderTemplate.copy()
.subject("CN=com.eatthepath.pushy")
.setKeyUsage(true, CertificateBuilder.KeyUsage.digitalSignature, CertificateBuilder.KeyUsage.keyEncipherment)
.addExtendedKeyUsage(CertificateBuilder.ExtendedKeyUsage.PKIX_KP_CLIENT_AUTH)
.addExtendedKeyUsage(CertificateBuilder.ExtendedKeyUsage.PKIX_KP_SERVER_AUTH)
.setIsCertificateAuthority(false)
.addSanDnsName("localhost")
.buildIssuedBy(CA_BUNDLE);

final ApnsSigningKey signingKey;
{
final KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC");
Expand All @@ -89,14 +113,14 @@ public void setUp() throws Exception {
.setApnsServer(HOST, PORT)
.setConcurrentConnections(this.concurrentConnections)
.setSigningKey(signingKey)
.setTrustedServerCertificateChain(ApnsClientBenchmark.class.getResourceAsStream(CA_CERTIFICATE_FILENAME))
.setTrustedServerCertificateChain(CA_BUNDLE.getCertificate())
.setApnsClientResources(this.clientResources)
.build();

this.server = new BenchmarkApnsServerBuilder()
.setServerCredentials(getClass().getResourceAsStream(SERVER_CERTIFICATES_FILENAME), this.getClass().getResourceAsStream(SERVER_KEY_FILENAME), null)
.setTrustedClientCertificateChain(getClass().getResourceAsStream(CA_CERTIFICATE_FILENAME))
.setEventLoopGroup(this.serverEventLoopGroup)
.setServerCredentials(SERVER_CERTIFICATE_BUNDLE.getCertificatePathWithRoot(), SERVER_CERTIFICATE_BUNDLE.getKeyPair().getPrivate())
.setTrustedClientCertificateChain(CA_BUNDLE.getCertificate())
.setIoEventLoopGroup(this.serverEventLoopGroup)
.build();

this.pushNotifications = new ArrayList<>(this.notificationCount);
Expand Down
19 changes: 0 additions & 19 deletions benchmark/src/main/resources/ca.pem

This file was deleted.

17 changes: 0 additions & 17 deletions benchmark/src/main/resources/server_certs.pem

This file was deleted.

28 changes: 0 additions & 28 deletions benchmark/src/main/resources/server_key.pem

This file was deleted.

10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@
<module>micrometer-metrics-listener</module>
</modules>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>4.1.133.Final</version>
<version>4.2.14.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -112,10 +116,6 @@
</dependencies>
</dependencyManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<pluginManagement>
<plugins>
Expand Down
9 changes: 9 additions & 0 deletions pushy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,21 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-pkitesting</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-io_uring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
Expand Down
32 changes: 0 additions & 32 deletions pushy/script/apns-extensions.cnf

This file was deleted.

51 changes: 0 additions & 51 deletions pushy/script/generate-certs.sh

This file was deleted.

Loading
Loading