send abort to close test connection
This commit is contained in:
parent
f0d4d9d75a
commit
6e066d43c2
2 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,5 @@
|
||||||
package org.capnproto;
|
package org.capnproto;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public interface VatNetwork<VatId>
|
public interface VatNetwork<VatId>
|
||||||
|
|
|
@ -33,10 +33,11 @@ import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import static org.capnproto.RpcState.FromException;
|
||||||
|
|
||||||
public class RpcTest {
|
public class RpcTest {
|
||||||
|
|
||||||
final class TestNetwork {
|
static final class TestNetwork {
|
||||||
|
|
||||||
final Map<String, TestNetworkAdapter> map = new HashMap<>();
|
final Map<String, TestNetworkAdapter> map = new HashMap<>();
|
||||||
int received = 0;
|
int received = 0;
|
||||||
|
@ -51,7 +52,7 @@ public class RpcTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class TestNetworkAdapter
|
static final class TestNetworkAdapter
|
||||||
implements VatNetwork<Test.TestSturdyRef.Reader> {
|
implements VatNetwork<Test.TestSturdyRef.Reader> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -169,6 +170,10 @@ public class RpcTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
var msg = newOutgoingMessage(0);
|
||||||
|
var abort = msg.getBody().initAs(RpcProtocol.Message.factory).initAbort();
|
||||||
|
FromException(RpcException.disconnected(""), abort);
|
||||||
|
msg.send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue