diff --git a/oncrpc4j-core/src/main/java/org/dcache/oncrpc4j/rpc/RpcCall.java b/oncrpc4j-core/src/main/java/org/dcache/oncrpc4j/rpc/RpcCall.java index 53fba20..71f899b 100644 --- a/oncrpc4j-core/src/main/java/org/dcache/oncrpc4j/rpc/RpcCall.java +++ b/oncrpc4j-core/src/main/java/org/dcache/oncrpc4j/rpc/RpcCall.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 - 2021 Deutsches Elektronen-Synchroton, + * Copyright (c) 2009 - 2022 Deutsches Elektronen-Synchroton, * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY * * This library is free software; you can redistribute it and/or modify @@ -295,9 +295,9 @@ public void startTLS() throws IOException { public void reject(int status, XdrAble reason) { XdrEncodingStream xdr = _xdr; try { - RpcMessage replyMessage = new RpcMessage(_xid, RpcMessageType.REPLY); xdr.beginEncoding(); - replyMessage.xdrEncode(_xdr); + xdr.xdrEncodeInt(_xid); + xdr.xdrEncodeInt(RpcMessageType.REPLY); xdr.xdrEncodeInt(RpcReplyStatus.MSG_DENIED); xdr.xdrEncodeInt(status); reason.xdrEncode(_xdr); @@ -324,9 +324,9 @@ public void acceptedReply(int state, XdrAble reply) { XdrEncodingStream xdr = _xdr; try { - RpcMessage replyMessage = new RpcMessage(_xid, RpcMessageType.REPLY); xdr.beginEncoding(); - replyMessage.xdrEncode(_xdr); + xdr.xdrEncodeInt(_xid); + xdr.xdrEncodeInt(RpcMessageType.REPLY); xdr.xdrEncodeInt(RpcReplyStatus.MSG_ACCEPTED); _cred.getVerifier().xdrEncode(xdr); xdr.xdrEncodeInt(state); @@ -459,8 +459,8 @@ private int callInternal(int procedure, XdrAble args, CompletionHandler callback = _replyQueue.get(message.xid()); + RpcReply reply = new RpcReply(xid, xdr, transport); + CompletionHandler callback = _replyQueue.get(xid); if (callback != null) { if (!reply.isAccepted()) { callback.failed(new OncRpcRejectedException(reply.getRejectStatus()), transport); diff --git a/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/RpcMessageParserTCPTest.java b/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/RpcMessageParserTCPTest.java index 0ac55a0..f270a37 100644 --- a/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/RpcMessageParserTCPTest.java +++ b/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/RpcMessageParserTCPTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 - 2018 Deutsches Elektronen-Synchroton, + * Copyright (c) 2009 - 2022 Deutsches Elektronen-Synchroton, * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY * * This library is free software; you can redistribute it and/or modify @@ -19,13 +19,6 @@ */ package org.dcache.oncrpc4j.rpc; -import org.dcache.oncrpc4j.rpc.RpcAuth; -import org.dcache.oncrpc4j.rpc.RpcMessageParserTCP; -import org.dcache.oncrpc4j.rpc.RpcMessage; -import org.dcache.oncrpc4j.rpc.ReplyQueue; -import org.dcache.oncrpc4j.rpc.RpcMessageType; -import org.dcache.oncrpc4j.rpc.RpcAuthTypeNone; -import org.dcache.oncrpc4j.rpc.RpcProtocolFilter; import org.dcache.oncrpc4j.xdr.XdrVoid; import org.dcache.oncrpc4j.xdr.XdrAble; import org.dcache.oncrpc4j.xdr.XdrString; @@ -147,8 +140,8 @@ public Xdr build() throws OncRpcException, IOException { Xdr xdr = new Xdr(Xdr.MAX_XDR_SIZE); xdr.beginEncoding(); - RpcMessage rpcMessage = new RpcMessage(xid, RpcMessageType.CALL); - rpcMessage.xdrEncode(xdr); + xdr.xdrEncodeInt(xid); + xdr.xdrEncodeInt(RpcMessageType.CALL); xdr.xdrEncodeInt(rpcvers); xdr.xdrEncodeInt(prog); xdr.xdrEncodeInt(vers); diff --git a/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/RpcProtocolFilterTest.java b/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/RpcProtocolFilterTest.java index 71fb005..0e44288 100644 --- a/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/RpcProtocolFilterTest.java +++ b/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/RpcProtocolFilterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 - 2018 Deutsches Elektronen-Synchroton, + * Copyright (c) 2009 - 2022 Deutsches Elektronen-Synchroton, * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY * * This library is free software; you can redistribute it and/or modify @@ -19,9 +19,6 @@ */ package org.dcache.oncrpc4j.rpc; -import org.dcache.oncrpc4j.rpc.RpcMessage; -import org.dcache.oncrpc4j.rpc.ReplyQueue; -import org.dcache.oncrpc4j.rpc.RpcProtocolFilter; import org.dcache.oncrpc4j.xdr.Xdr; import java.io.IOException; import org.glassfish.grizzly.Connection; @@ -58,8 +55,8 @@ public void testSomeMethod() throws IOException { private Xdr createBadXdr() { Xdr xdr = new Xdr(32); xdr.beginEncoding(); - RpcMessage rpcMessage = new RpcMessage(1, 2); // xdr, type 0 = call, 1 = reply, 2 = not allowed - rpcMessage.xdrEncode(xdr); + xdr.xdrEncodeInt(1); // xid + xdr.xdrEncodeInt(2); // type: 0 = call, 1 = reply, x = invalid return xdr; } }