code: private IoBuffer encodeInvoke(String method, Object[] params) {
          log.debug("RemotingClient encodeInvoke - method: {} params: {}", method, params);
          IoBuffer result = IoBuffer.allocate(1024);
          result.setAutoExpand(true);
          //force version 3
          result.putShort((short) 3);
          // Headers
          Collection<RemotingHeader> hdr = headers.values();
          result.putShort((short) hdr.size());
          for (RemotingHeader header : hdr) {
              Output.putString(result, header.getName());
              result.put(header.getMustUnderstand() ? (byte) 0x01 : (byte) 0x00);
  
              IoBuffer tmp = IoBuffer.allocate(1024);
              tmp.setAutoExpand(true);
              Output tmpOut = new Output(tmp);
              Serializer.serialize(tmpOut, header.getValue());
              tmp.flip();
              // Size of header data
              result.putInt(tmp.limit());
              // Header data
              result.put(tmp);
              tmp.free();
              tmp = null;
          }
          // One body
          result.putShort((short) 1);
          // Method name
          Output.putString(result, method);
          // Client callback for response
          //Output.putString(result, "");
          //responseURI 
          Output.putString(result, "/" + sequenceCounter++);
          // Serialize parameters
          IoBuffer tmp = IoBuffer.allocate(1024);
          tmp.setAutoExpand(true);
          Output tmpOut = new Output(tmp);
          //if the params are null send the NULL AMF type
          //this should fix APPSERVER-296
          if (params == null) {
              tmpOut.writeNull();
          } else {
              tmpOut.writeArray(params);
          }
          tmp.flip();
          // Store size and parameters
          result.putInt(tmp.limit());
          result.put(tmp);
          tmp.free();
          tmp = null;
  
          result.flip();
          return result;
      }
docs: Encode the method call.
  
  @param method
  Remote method being called
  @param params
  Method parameters
  @return Byte buffer with data to perform remoting call