Search in sources :

Example 1 with ConnectionClosedException

use of io.libp2p.core.ConnectionClosedException in project teku by ConsenSys.

the class RpcHandlerTest method sendRequest_streamClosedRightBeforeCreateStreamShouldThrowPeerDisconnectedException.

@Test
void sendRequest_streamClosedRightBeforeCreateStreamShouldThrowPeerDisconnectedException() {
    when(session.createStream((ProtocolBinding<Controller<RpcRequestHandler>>) any())).thenThrow(new ConnectionClosedException());
    SafeFuture<RpcStreamController<RpcRequestHandler>> future = rpcHandler.sendRequest(connection, request, responseHandler);
    assertThatSafeFuture(future).isCompletedExceptionallyWith(PeerDisconnectedException.class);
}
Also used : RpcStreamController(tech.pegasys.teku.networking.p2p.rpc.RpcStreamController) ConnectionClosedException(io.libp2p.core.ConnectionClosedException) Controller(tech.pegasys.teku.networking.p2p.libp2p.rpc.RpcHandler.Controller) RpcStreamController(tech.pegasys.teku.networking.p2p.rpc.RpcStreamController) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ConnectionClosedException (io.libp2p.core.ConnectionClosedException)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 Controller (tech.pegasys.teku.networking.p2p.libp2p.rpc.RpcHandler.Controller)1 RpcStreamController (tech.pegasys.teku.networking.p2p.rpc.RpcStreamController)1