.setSslContextRefreshTime(new Duration(33, MINUTES)) .setAllowPlaintext(false) .setSslEnabled(true) .setTrustCertificate(new File("trust")) .setKey(new File("key"))
.setSslContextRefreshTime(new Duration(33, MINUTES)) .setAllowPlaintext(false) .setSslEnabled(true) .setTrustCertificate(new File("trust")) .setKey(new File("key"))
private static void testDriftServer(DriftService service, Consumer<HostAndPort> task) { DriftNettyServerConfig config = new DriftNettyServerConfig() .setSslEnabled(true) .setTrustCertificate(ClientTestUtils.getCertificateChainFile()) .setKey(ClientTestUtils.getPrivateKeyFile()); TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); DriftServer driftServer = new DriftServer( new DriftNettyServerTransportFactory(config, testingAllocator), CODEC_MANAGER, new NullMethodInvocationStatsFactory(), ImmutableSet.of(service), ImmutableSet.of()); try { driftServer.start(); HostAndPort address = HostAndPort.fromParts("localhost", ((DriftNettyServerTransport) driftServer.getServerTransport()).getPort()); task.accept(address); } finally { driftServer.shutdown(); testingAllocator.close(); } } }
private static int testDriftServer(ServerMethodInvoker methodInvoker, List<ToIntFunction<HostAndPort>> clients) { DriftNettyServerConfig config = new DriftNettyServerConfig() .setSslEnabled(true) .setTrustCertificate(ClientTestUtils.getCertificateChainFile()) .setKey(ClientTestUtils.getPrivateKeyFile()); TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); ServerTransport serverTransport = new DriftNettyServerTransportFactory(config, testingAllocator).createServerTransport(methodInvoker); try { serverTransport.start(); HostAndPort address = HostAndPort.fromParts("localhost", ((DriftNettyServerTransport) serverTransport).getPort()); int sum = 0; for (ToIntFunction<HostAndPort> client : clients) { sum += client.applyAsInt(address); } return sum; } finally { serverTransport.shutdown(); testingAllocator.close(); } }