public static void encode(HornetQBuffer buffer, TransportConfiguration config) {
   BufferHelper.writeAsNullableSimpleString(buffer, config.getName());
   BufferHelper.writeAsSimpleString(buffer, config.getFactoryClassName());
   buffer.writeInt(config.getParams().size());
   for (Entry<String, Object> param : config.getParams().entrySet()) {
     BufferHelper.writeAsSimpleString(buffer, param.getKey());
     BufferHelper.writeAsSimpleString(buffer, param.getValue().toString());
   }
 }
  public static int getEncodeSize(TransportConfiguration config) {
    int size =
        BufferHelper.sizeOfNullableSimpleString(config.getName())
            + BufferHelper.sizeOfSimpleString(config.getFactoryClassName());

    size += DataConstants.SIZE_INT; // number of params
    for (Entry<String, Object> param : config.getParams().entrySet()) {
      size += BufferHelper.sizeOfSimpleString(param.getKey());
      size += BufferHelper.sizeOfSimpleString(param.getValue().toString());
    }
    return size;
  }
 public static TransportConfiguration decode(HornetQBuffer buffer) {
   String name = BufferHelper.readNullableSimpleStringAsString(buffer);
   String factoryClassName = buffer.readSimpleString().toString();
   int paramSize = buffer.readInt();
   Map<String, Object> params = new HashMap<String, Object>();
   for (int i = 0; i < paramSize; i++) {
     String key = buffer.readSimpleString().toString();
     String value = buffer.readSimpleString().toString();
     params.put(key, value);
   }
   TransportConfiguration config = new TransportConfiguration(factoryClassName, params, name);
   return config;
 }