RPClient { public TCBuffer send(TCBuffer outTCBuffer) throws IOException { if(!rpSock.isConnected()){ rpSock.connect(rpcoreEndpoint); } ByteArrayOutputStream rpOutStream = new ByteArrayOutputStream(); OutputStream rpcoreOut = rpSock.getOutputStream(); rpOutStream.writeTo(rpcoreOut); rpOutStream.flush(); rpcoreOut.flush(); outTCBuffer.serializeTCBuffer(rpcoreOut); InputStream rpcoreIn = rpSock.getInputStream(); TCBuffer inTCBuffer = new TCBuffer(); inTCBuffer.deSerializeTCBuffer(rpcoreIn); return inTCBuffer; } RPClient(String hostName, int port); InetSocketAddress getRpcoreEndpoint(); void setRpcoreEndpoint(String hostName, int port); Socket getRpSock(); void setRpSock(); TCBuffer send(TCBuffer outTCBuffer); void close(); boolean getVmStatus(String vmInstanceId); String getVMAttestationReportPath(String vmInstanceId, String nonce);  }
@Test public void testSend() throws Exception { String xmlRPCBlob= "<?xml version='1.0'?>" + "<methodCall>" + "<methodName>get_verification_status</methodName>" + "<params>" + "<param>" + "<value><string>%s</string></value>" + "</param>" + "</params>" + "</methodCall>"; TCBuffer tcBuffer = Factory.newTCBuffer(RPCCall.IS_VM_VERIFIED); String base64InputArgument = String.format(xmlRPCBlob, DatatypeConverter.printBase64Binary(("425d20e9-0132-48d7-a3d6-563775968efe").getBytes())); System.out.println(base64InputArgument); tcBuffer.setRPCPayload(base64InputArgument.getBytes()); System.out.println("send"); TCBuffer expResult = null; RPClient instance = new RPClient("10.1.71.68", 16005); TCBuffer result = instance.send(tcBuffer); System.out.println("RPC Call Index =" + result.getRPCCallIndex()); System.out.println("RPC Payload Size = " + result.getRPCPayloadSize()); System.out.println("RPC Call Status = " + result.getRPCCallStatus()); System.out.println("RPC Payload = " + result.getRPCPayload()); instance.close(); }