|
| 1 | +/* |
| 2 | + * Copyright 2015-present the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package io.rsocket.transport.aeron; |
| 18 | + |
| 19 | +import io.aeron.Aeron; |
| 20 | +import io.aeron.driver.MediaDriver; |
| 21 | +import io.aeron.driver.ThreadingMode; |
| 22 | +import io.rsocket.test.TransportTest; |
| 23 | +import java.net.InetSocketAddress; |
| 24 | +import java.time.Duration; |
| 25 | +import java.util.concurrent.ThreadLocalRandom; |
| 26 | +import org.junit.jupiter.api.Disabled; |
| 27 | + |
| 28 | +@Disabled |
| 29 | +final class AeronWithFragmentationTransportTest |
| 30 | + extends TransportTest<InetSocketAddress, AeronServer> { |
| 31 | + |
| 32 | + static final MediaDriver mediaDriver = |
| 33 | + MediaDriver.launch( |
| 34 | + new MediaDriver.Context().threadingMode(ThreadingMode.DEDICATED).dirDeleteOnStart(true)); |
| 35 | + |
| 36 | + static final Aeron clientAeron = Aeron.connect(); |
| 37 | + static final Aeron serverAeron = Aeron.connect(); |
| 38 | + static final EventLoopGroup eventLoopGroup = EventLoopGroup.create(4); |
| 39 | + |
| 40 | + @Override |
| 41 | + protected TransportPair<InetSocketAddress, AeronServer> createTransportPair() { |
| 42 | + return new AeronTransportPair(mediaDriver, clientAeron, serverAeron); |
| 43 | + } |
| 44 | + |
| 45 | + static class AeronTransportPair extends TransportPair<InetSocketAddress, AeronServer> { |
| 46 | + |
| 47 | + final MediaDriver mediaDriver; |
| 48 | + final Aeron clientAeron; |
| 49 | + final Aeron serverAeron; |
| 50 | + |
| 51 | + public AeronTransportPair(MediaDriver driver, Aeron clientAeron, Aeron serverAeron) { |
| 52 | + super( |
| 53 | + () -> |
| 54 | + InetSocketAddress.createUnresolved( |
| 55 | + "0.0.0.0", ThreadLocalRandom.current().nextInt(20000) + 5000), |
| 56 | + (address, server, allocator) -> |
| 57 | + AeronClientTransport.createIpc(clientAeron, eventLoopGroup), |
| 58 | + (address, allocator) -> AeronServerTransport.createIpc(serverAeron, eventLoopGroup), |
| 59 | + true, |
| 60 | + false, |
| 61 | + false, |
| 62 | + Duration.ofMinutes(2)); |
| 63 | + this.mediaDriver = driver; |
| 64 | + this.clientAeron = clientAeron; |
| 65 | + this.serverAeron = serverAeron; |
| 66 | + } |
| 67 | + |
| 68 | + @Override |
| 69 | + public void dispose() { |
| 70 | + super.dispose(); |
| 71 | + // CloseHelper.quietCloseAll(clientAeron, serverAeron); |
| 72 | + } |
| 73 | + } |
| 74 | +} |
0 commit comments