/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-3-12")
public class BusinessLogicService {

  public interface Iface {

    public String handleRequest(MessageInfo messageInfo) throws message_error, org.apache.thrift.TException;

    public void handleMessage(MessageInfo messageInfo) throws message_error, org.apache.thrift.TException;

    public String handleAuth(MessageInfo messageInfo) throws message_error, org.apache.thrift.TException;

    public void handleMessageByUsername(String username, MessageInfo messageInfo) throws message_error, org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void handleRequest(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void handleMessage(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void handleAuth(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void handleMessageByUsername(String username, MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
      public Factory() {}
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot)
    {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public String handleRequest(MessageInfo messageInfo) throws message_error, org.apache.thrift.TException
    {
      send_handleRequest(messageInfo);
      return recv_handleRequest();
    }

    public void send_handleRequest(MessageInfo messageInfo) throws org.apache.thrift.TException
    {
      handleRequest_args args = new handleRequest_args();
      args.setMessageInfo(messageInfo);
      sendBase("handleRequest", args);
    }

    public String recv_handleRequest() throws message_error, org.apache.thrift.TException
    {
      handleRequest_result result = new handleRequest_result();
      receiveBase(result, "handleRequest");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.error != null) {
        throw result.error;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "handleRequest failed: unknown result");
    }

    public void handleMessage(MessageInfo messageInfo) throws message_error, org.apache.thrift.TException
    {
      send_handleMessage(messageInfo);
      recv_handleMessage();
    }

    public void send_handleMessage(MessageInfo messageInfo) throws org.apache.thrift.TException
    {
      handleMessage_args args = new handleMessage_args();
      args.setMessageInfo(messageInfo);
      sendBase("handleMessage", args);
    }

    public void recv_handleMessage() throws message_error, org.apache.thrift.TException
    {
      handleMessage_result result = new handleMessage_result();
      receiveBase(result, "handleMessage");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

    public String handleAuth(MessageInfo messageInfo) throws message_error, org.apache.thrift.TException
    {
      send_handleAuth(messageInfo);
      return recv_handleAuth();
    }

    public void send_handleAuth(MessageInfo messageInfo) throws org.apache.thrift.TException
    {
      handleAuth_args args = new handleAuth_args();
      args.setMessageInfo(messageInfo);
      sendBase("handleAuth", args);
    }

    public String recv_handleAuth() throws message_error, org.apache.thrift.TException
    {
      handleAuth_result result = new handleAuth_result();
      receiveBase(result, "handleAuth");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.error != null) {
        throw result.error;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "handleAuth failed: unknown result");
    }

    public void handleMessageByUsername(String username, MessageInfo messageInfo) throws message_error, org.apache.thrift.TException
    {
      send_handleMessageByUsername(username, messageInfo);
      recv_handleMessageByUsername();
    }

    public void send_handleMessageByUsername(String username, MessageInfo messageInfo) throws org.apache.thrift.TException
    {
      handleMessageByUsername_args args = new handleMessageByUsername_args();
      args.setUsername(username);
      args.setMessageInfo(messageInfo);
      sendBase("handleMessageByUsername", args);
    }

    public void recv_handleMessageByUsername() throws message_error, org.apache.thrift.TException
    {
      handleMessageByUsername_result result = new handleMessageByUsername_result();
      receiveBase(result, "handleMessageByUsername");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    public void handleRequest(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      handleRequest_call method_call = new handleRequest_call(messageInfo, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class handleRequest_call extends org.apache.thrift.async.TAsyncMethodCall {
      private MessageInfo messageInfo;
      public handleRequest_call(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.messageInfo = messageInfo;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("handleRequest", org.apache.thrift.protocol.TMessageType.CALL, 0));
        handleRequest_args args = new handleRequest_args();
        args.setMessageInfo(messageInfo);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public String getResult() throws message_error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_handleRequest();
      }
    }

    public void handleMessage(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      handleMessage_call method_call = new handleMessage_call(messageInfo, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class handleMessage_call extends org.apache.thrift.async.TAsyncMethodCall {
      private MessageInfo messageInfo;
      public handleMessage_call(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.messageInfo = messageInfo;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("handleMessage", org.apache.thrift.protocol.TMessageType.CALL, 0));
        handleMessage_args args = new handleMessage_args();
        args.setMessageInfo(messageInfo);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws message_error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_handleMessage();
      }
    }

    public void handleAuth(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      handleAuth_call method_call = new handleAuth_call(messageInfo, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class handleAuth_call extends org.apache.thrift.async.TAsyncMethodCall {
      private MessageInfo messageInfo;
      public handleAuth_call(MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.messageInfo = messageInfo;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("handleAuth", org.apache.thrift.protocol.TMessageType.CALL, 0));
        handleAuth_args args = new handleAuth_args();
        args.setMessageInfo(messageInfo);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public String getResult() throws message_error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_handleAuth();
      }
    }

    public void handleMessageByUsername(String username, MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      handleMessageByUsername_call method_call = new handleMessageByUsername_call(username, messageInfo, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class handleMessageByUsername_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String username;
      private MessageInfo messageInfo;
      public handleMessageByUsername_call(String username, MessageInfo messageInfo, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.username = username;
        this.messageInfo = messageInfo;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("handleMessageByUsername", org.apache.thrift.protocol.TMessageType.CALL, 0));
        handleMessageByUsername_args args = new handleMessageByUsername_args();
        args.setUsername(username);
        args.setMessageInfo(messageInfo);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws message_error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_handleMessageByUsername();
      }
    }

  }

  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
    }

    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      processMap.put("handleRequest", new handleRequest());
      processMap.put("handleMessage", new handleMessage());
      processMap.put("handleAuth", new handleAuth());
      processMap.put("handleMessageByUsername", new handleMessageByUsername());
      return processMap;
    }

    public static class handleRequest<I extends Iface> extends org.apache.thrift.ProcessFunction<I, handleRequest_args> {
      public handleRequest() {
        super("handleRequest");
      }

      public handleRequest_args getEmptyArgsInstance() {
        return new handleRequest_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public handleRequest_result getResult(I iface, handleRequest_args args) throws org.apache.thrift.TException {
        handleRequest_result result = new handleRequest_result();
        try {
          result.success = iface.handleRequest(args.messageInfo);
        } catch (message_error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class handleMessage<I extends Iface> extends org.apache.thrift.ProcessFunction<I, handleMessage_args> {
      public handleMessage() {
        super("handleMessage");
      }

      public handleMessage_args getEmptyArgsInstance() {
        return new handleMessage_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public handleMessage_result getResult(I iface, handleMessage_args args) throws org.apache.thrift.TException {
        handleMessage_result result = new handleMessage_result();
        try {
          iface.handleMessage(args.messageInfo);
        } catch (message_error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class handleAuth<I extends Iface> extends org.apache.thrift.ProcessFunction<I, handleAuth_args> {
      public handleAuth() {
        super("handleAuth");
      }

      public handleAuth_args getEmptyArgsInstance() {
        return new handleAuth_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public handleAuth_result getResult(I iface, handleAuth_args args) throws org.apache.thrift.TException {
        handleAuth_result result = new handleAuth_result();
        try {
          result.success = iface.handleAuth(args.messageInfo);
        } catch (message_error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class handleMessageByUsername<I extends Iface> extends org.apache.thrift.ProcessFunction<I, handleMessageByUsername_args> {
      public handleMessageByUsername() {
        super("handleMessageByUsername");
      }

      public handleMessageByUsername_args getEmptyArgsInstance() {
        return new handleMessageByUsername_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public handleMessageByUsername_result getResult(I iface, handleMessageByUsername_args args) throws org.apache.thrift.TException {
        handleMessageByUsername_result result = new handleMessageByUsername_result();
        try {
          iface.handleMessageByUsername(args.username, args.messageInfo);
        } catch (message_error error) {
          result.error = error;
        }
        return result;
      }
    }

  }

  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
    }

    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      processMap.put("handleRequest", new handleRequest());
      processMap.put("handleMessage", new handleMessage());
      processMap.put("handleAuth", new handleAuth());
      processMap.put("handleMessageByUsername", new handleMessageByUsername());
      return processMap;
    }

    public static class handleRequest<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, handleRequest_args, String> {
      public handleRequest() {
        super("handleRequest");
      }

      public handleRequest_args getEmptyArgsInstance() {
        return new handleRequest_args();
      }

      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<String>() { 
          public void onComplete(String o) {
            handleRequest_result result = new handleRequest_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            handleRequest_result result = new handleRequest_result();
            if (e instanceof message_error) {
                        result.error = (message_error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, handleRequest_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
        iface.handleRequest(args.messageInfo,resultHandler);
      }
    }

    public static class handleMessage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, handleMessage_args, Void> {
      public handleMessage() {
        super("handleMessage");
      }

      public handleMessage_args getEmptyArgsInstance() {
        return new handleMessage_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            handleMessage_result result = new handleMessage_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            handleMessage_result result = new handleMessage_result();
            if (e instanceof message_error) {
                        result.error = (message_error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, handleMessage_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.handleMessage(args.messageInfo,resultHandler);
      }
    }

    public static class handleAuth<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, handleAuth_args, String> {
      public handleAuth() {
        super("handleAuth");
      }

      public handleAuth_args getEmptyArgsInstance() {
        return new handleAuth_args();
      }

      public AsyncMethodCallback<String> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<String>() { 
          public void onComplete(String o) {
            handleAuth_result result = new handleAuth_result();
            result.success = o;
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            handleAuth_result result = new handleAuth_result();
            if (e instanceof message_error) {
                        result.error = (message_error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, handleAuth_args args, org.apache.thrift.async.AsyncMethodCallback<String> resultHandler) throws TException {
        iface.handleAuth(args.messageInfo,resultHandler);
      }
    }

    public static class handleMessageByUsername<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, handleMessageByUsername_args, Void> {
      public handleMessageByUsername() {
        super("handleMessageByUsername");
      }

      public handleMessageByUsername_args getEmptyArgsInstance() {
        return new handleMessageByUsername_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            handleMessageByUsername_result result = new handleMessageByUsername_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            handleMessageByUsername_result result = new handleMessageByUsername_result();
            if (e instanceof message_error) {
                        result.error = (message_error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
            }
            try {
              fcall.sendResponse(fb,msg,msgType,seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, handleMessageByUsername_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.handleMessageByUsername(args.username, args.messageInfo,resultHandler);
      }
    }

  }

  public static class handleRequest_args implements org.apache.thrift.TBase<handleRequest_args, handleRequest_args._Fields>, java.io.Serializable, Cloneable, Comparable<handleRequest_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("handleRequest_args");

    private static final org.apache.thrift.protocol.TField MESSAGE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("messageInfo", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new handleRequest_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new handleRequest_argsTupleSchemeFactory());
    }

    public MessageInfo messageInfo; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      MESSAGE_INFO((short)1, "messageInfo");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // MESSAGE_INFO
            return MESSAGE_INFO;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.MESSAGE_INFO, new org.apache.thrift.meta_data.FieldMetaData("messageInfo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MessageInfo.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(handleRequest_args.class, metaDataMap);
    }

    public handleRequest_args() {
    }

    public handleRequest_args(
      MessageInfo messageInfo)
    {
      this();
      this.messageInfo = messageInfo;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public handleRequest_args(handleRequest_args other) {
      if (other.isSetMessageInfo()) {
        this.messageInfo = new MessageInfo(other.messageInfo);
      }
    }

    public handleRequest_args deepCopy() {
      return new handleRequest_args(this);
    }

    @Override
    public void clear() {
      this.messageInfo = null;
    }

    public MessageInfo getMessageInfo() {
      return this.messageInfo;
    }

    public handleRequest_args setMessageInfo(MessageInfo messageInfo) {
      this.messageInfo = messageInfo;
      return this;
    }

    public void unsetMessageInfo() {
      this.messageInfo = null;
    }

    /** Returns true if field messageInfo is set (has been assigned a value) and false otherwise */
    public boolean isSetMessageInfo() {
      return this.messageInfo != null;
    }

    public void setMessageInfoIsSet(boolean value) {
      if (!value) {
        this.messageInfo = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case MESSAGE_INFO:
        if (value == null) {
          unsetMessageInfo();
        } else {
          setMessageInfo((MessageInfo)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case MESSAGE_INFO:
        return getMessageInfo();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case MESSAGE_INFO:
        return isSetMessageInfo();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof handleRequest_args)
        return this.equals((handleRequest_args)that);
      return false;
    }

    public boolean equals(handleRequest_args that) {
      if (that == null)
        return false;

      boolean this_present_messageInfo = true && this.isSetMessageInfo();
      boolean that_present_messageInfo = true && that.isSetMessageInfo();
      if (this_present_messageInfo || that_present_messageInfo) {
        if (!(this_present_messageInfo && that_present_messageInfo))
          return false;
        if (!this.messageInfo.equals(that.messageInfo))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_messageInfo = true && (isSetMessageInfo());
      list.add(present_messageInfo);
      if (present_messageInfo)
        list.add(messageInfo);

      return list.hashCode();
    }

    @Override
    public int compareTo(handleRequest_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetMessageInfo()).compareTo(other.isSetMessageInfo());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetMessageInfo()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messageInfo, other.messageInfo);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("handleRequest_args(");
      boolean first = true;

      sb.append("messageInfo:");
      if (this.messageInfo == null) {
        sb.append("null");
      } else {
        sb.append(this.messageInfo);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (messageInfo != null) {
        messageInfo.validate();
      }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class handleRequest_argsStandardSchemeFactory implements SchemeFactory {
      public handleRequest_argsStandardScheme getScheme() {
        return new handleRequest_argsStandardScheme();
      }
    }

    private static class handleRequest_argsStandardScheme extends StandardScheme<handleRequest_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, handleRequest_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // MESSAGE_INFO
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.messageInfo = new MessageInfo();
                struct.messageInfo.read(iprot);
                struct.setMessageInfoIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, handleRequest_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.messageInfo != null) {
          oprot.writeFieldBegin(MESSAGE_INFO_FIELD_DESC);
          struct.messageInfo.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class handleRequest_argsTupleSchemeFactory implements SchemeFactory {
      public handleRequest_argsTupleScheme getScheme() {
        return new handleRequest_argsTupleScheme();
      }
    }

    private static class handleRequest_argsTupleScheme extends TupleScheme<handleRequest_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, handleRequest_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetMessageInfo()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetMessageInfo()) {
          struct.messageInfo.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, handleRequest_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.messageInfo = new MessageInfo();
          struct.messageInfo.read(iprot);
          struct.setMessageInfoIsSet(true);
        }
      }
    }

  }

  public static class handleRequest_result implements org.apache.thrift.TBase<handleRequest_result, handleRequest_result._Fields>, java.io.Serializable, Cloneable, Comparable<handleRequest_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("handleRequest_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new handleRequest_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new handleRequest_resultTupleSchemeFactory());
    }

    public String success; // required
    public message_error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short)0, "success"),
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          case 1: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(handleRequest_result.class, metaDataMap);
    }

    public handleRequest_result() {
    }

    public handleRequest_result(
      String success,
      message_error error)
    {
      this();
      this.success = success;
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public handleRequest_result(handleRequest_result other) {
      if (other.isSetSuccess()) {
        this.success = other.success;
      }
      if (other.isSetError()) {
        this.error = new message_error(other.error);
      }
    }

    public handleRequest_result deepCopy() {
      return new handleRequest_result(this);
    }

    @Override
    public void clear() {
      this.success = null;
      this.error = null;
    }

    public String getSuccess() {
      return this.success;
    }

    public handleRequest_result setSuccess(String success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public message_error getError() {
      return this.error;
    }

    public handleRequest_result setError(message_error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((String)value);
        }
        break;

      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((message_error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ERROR:
        return getError();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case SUCCESS:
        return isSetSuccess();
      case ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof handleRequest_result)
        return this.equals((handleRequest_result)that);
      return false;
    }

    public boolean equals(handleRequest_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_success = true && (isSetSuccess());
      list.add(present_success);
      if (present_success)
        list.add(success);

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(handleRequest_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("handleRequest_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class handleRequest_resultStandardSchemeFactory implements SchemeFactory {
      public handleRequest_resultStandardScheme getScheme() {
        return new handleRequest_resultStandardScheme();
      }
    }

    private static class handleRequest_resultStandardScheme extends StandardScheme<handleRequest_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, handleRequest_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.success = iprot.readString();
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new message_error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, handleRequest_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          oprot.writeString(struct.success);
          oprot.writeFieldEnd();
        }
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class handleRequest_resultTupleSchemeFactory implements SchemeFactory {
      public handleRequest_resultTupleScheme getScheme() {
        return new handleRequest_resultTupleScheme();
      }
    }

    private static class handleRequest_resultTupleScheme extends TupleScheme<handleRequest_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, handleRequest_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetError()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          oprot.writeString(struct.success);
        }
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, handleRequest_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = iprot.readString();
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.error = new message_error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class handleMessage_args implements org.apache.thrift.TBase<handleMessage_args, handleMessage_args._Fields>, java.io.Serializable, Cloneable, Comparable<handleMessage_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("handleMessage_args");

    private static final org.apache.thrift.protocol.TField MESSAGE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("messageInfo", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new handleMessage_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new handleMessage_argsTupleSchemeFactory());
    }

    public MessageInfo messageInfo; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      MESSAGE_INFO((short)1, "messageInfo");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // MESSAGE_INFO
            return MESSAGE_INFO;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.MESSAGE_INFO, new org.apache.thrift.meta_data.FieldMetaData("messageInfo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MessageInfo.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(handleMessage_args.class, metaDataMap);
    }

    public handleMessage_args() {
    }

    public handleMessage_args(
      MessageInfo messageInfo)
    {
      this();
      this.messageInfo = messageInfo;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public handleMessage_args(handleMessage_args other) {
      if (other.isSetMessageInfo()) {
        this.messageInfo = new MessageInfo(other.messageInfo);
      }
    }

    public handleMessage_args deepCopy() {
      return new handleMessage_args(this);
    }

    @Override
    public void clear() {
      this.messageInfo = null;
    }

    public MessageInfo getMessageInfo() {
      return this.messageInfo;
    }

    public handleMessage_args setMessageInfo(MessageInfo messageInfo) {
      this.messageInfo = messageInfo;
      return this;
    }

    public void unsetMessageInfo() {
      this.messageInfo = null;
    }

    /** Returns true if field messageInfo is set (has been assigned a value) and false otherwise */
    public boolean isSetMessageInfo() {
      return this.messageInfo != null;
    }

    public void setMessageInfoIsSet(boolean value) {
      if (!value) {
        this.messageInfo = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case MESSAGE_INFO:
        if (value == null) {
          unsetMessageInfo();
        } else {
          setMessageInfo((MessageInfo)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case MESSAGE_INFO:
        return getMessageInfo();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case MESSAGE_INFO:
        return isSetMessageInfo();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof handleMessage_args)
        return this.equals((handleMessage_args)that);
      return false;
    }

    public boolean equals(handleMessage_args that) {
      if (that == null)
        return false;

      boolean this_present_messageInfo = true && this.isSetMessageInfo();
      boolean that_present_messageInfo = true && that.isSetMessageInfo();
      if (this_present_messageInfo || that_present_messageInfo) {
        if (!(this_present_messageInfo && that_present_messageInfo))
          return false;
        if (!this.messageInfo.equals(that.messageInfo))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_messageInfo = true && (isSetMessageInfo());
      list.add(present_messageInfo);
      if (present_messageInfo)
        list.add(messageInfo);

      return list.hashCode();
    }

    @Override
    public int compareTo(handleMessage_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetMessageInfo()).compareTo(other.isSetMessageInfo());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetMessageInfo()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messageInfo, other.messageInfo);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("handleMessage_args(");
      boolean first = true;

      sb.append("messageInfo:");
      if (this.messageInfo == null) {
        sb.append("null");
      } else {
        sb.append(this.messageInfo);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (messageInfo != null) {
        messageInfo.validate();
      }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class handleMessage_argsStandardSchemeFactory implements SchemeFactory {
      public handleMessage_argsStandardScheme getScheme() {
        return new handleMessage_argsStandardScheme();
      }
    }

    private static class handleMessage_argsStandardScheme extends StandardScheme<handleMessage_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, handleMessage_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // MESSAGE_INFO
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.messageInfo = new MessageInfo();
                struct.messageInfo.read(iprot);
                struct.setMessageInfoIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, handleMessage_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.messageInfo != null) {
          oprot.writeFieldBegin(MESSAGE_INFO_FIELD_DESC);
          struct.messageInfo.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class handleMessage_argsTupleSchemeFactory implements SchemeFactory {
      public handleMessage_argsTupleScheme getScheme() {
        return new handleMessage_argsTupleScheme();
      }
    }

    private static class handleMessage_argsTupleScheme extends TupleScheme<handleMessage_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, handleMessage_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetMessageInfo()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetMessageInfo()) {
          struct.messageInfo.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, handleMessage_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.messageInfo = new MessageInfo();
          struct.messageInfo.read(iprot);
          struct.setMessageInfoIsSet(true);
        }
      }
    }

  }

  public static class handleMessage_result implements org.apache.thrift.TBase<handleMessage_result, handleMessage_result._Fields>, java.io.Serializable, Cloneable, Comparable<handleMessage_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("handleMessage_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new handleMessage_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new handleMessage_resultTupleSchemeFactory());
    }

    public message_error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(handleMessage_result.class, metaDataMap);
    }

    public handleMessage_result() {
    }

    public handleMessage_result(
      message_error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public handleMessage_result(handleMessage_result other) {
      if (other.isSetError()) {
        this.error = new message_error(other.error);
      }
    }

    public handleMessage_result deepCopy() {
      return new handleMessage_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public message_error getError() {
      return this.error;
    }

    public handleMessage_result setError(message_error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((message_error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof handleMessage_result)
        return this.equals((handleMessage_result)that);
      return false;
    }

    public boolean equals(handleMessage_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(handleMessage_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("handleMessage_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class handleMessage_resultStandardSchemeFactory implements SchemeFactory {
      public handleMessage_resultStandardScheme getScheme() {
        return new handleMessage_resultStandardScheme();
      }
    }

    private static class handleMessage_resultStandardScheme extends StandardScheme<handleMessage_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, handleMessage_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new message_error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, handleMessage_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class handleMessage_resultTupleSchemeFactory implements SchemeFactory {
      public handleMessage_resultTupleScheme getScheme() {
        return new handleMessage_resultTupleScheme();
      }
    }

    private static class handleMessage_resultTupleScheme extends TupleScheme<handleMessage_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, handleMessage_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, handleMessage_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new message_error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class handleAuth_args implements org.apache.thrift.TBase<handleAuth_args, handleAuth_args._Fields>, java.io.Serializable, Cloneable, Comparable<handleAuth_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("handleAuth_args");

    private static final org.apache.thrift.protocol.TField MESSAGE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("messageInfo", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new handleAuth_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new handleAuth_argsTupleSchemeFactory());
    }

    public MessageInfo messageInfo; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      MESSAGE_INFO((short)1, "messageInfo");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // MESSAGE_INFO
            return MESSAGE_INFO;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.MESSAGE_INFO, new org.apache.thrift.meta_data.FieldMetaData("messageInfo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MessageInfo.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(handleAuth_args.class, metaDataMap);
    }

    public handleAuth_args() {
    }

    public handleAuth_args(
      MessageInfo messageInfo)
    {
      this();
      this.messageInfo = messageInfo;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public handleAuth_args(handleAuth_args other) {
      if (other.isSetMessageInfo()) {
        this.messageInfo = new MessageInfo(other.messageInfo);
      }
    }

    public handleAuth_args deepCopy() {
      return new handleAuth_args(this);
    }

    @Override
    public void clear() {
      this.messageInfo = null;
    }

    public MessageInfo getMessageInfo() {
      return this.messageInfo;
    }

    public handleAuth_args setMessageInfo(MessageInfo messageInfo) {
      this.messageInfo = messageInfo;
      return this;
    }

    public void unsetMessageInfo() {
      this.messageInfo = null;
    }

    /** Returns true if field messageInfo is set (has been assigned a value) and false otherwise */
    public boolean isSetMessageInfo() {
      return this.messageInfo != null;
    }

    public void setMessageInfoIsSet(boolean value) {
      if (!value) {
        this.messageInfo = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case MESSAGE_INFO:
        if (value == null) {
          unsetMessageInfo();
        } else {
          setMessageInfo((MessageInfo)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case MESSAGE_INFO:
        return getMessageInfo();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case MESSAGE_INFO:
        return isSetMessageInfo();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof handleAuth_args)
        return this.equals((handleAuth_args)that);
      return false;
    }

    public boolean equals(handleAuth_args that) {
      if (that == null)
        return false;

      boolean this_present_messageInfo = true && this.isSetMessageInfo();
      boolean that_present_messageInfo = true && that.isSetMessageInfo();
      if (this_present_messageInfo || that_present_messageInfo) {
        if (!(this_present_messageInfo && that_present_messageInfo))
          return false;
        if (!this.messageInfo.equals(that.messageInfo))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_messageInfo = true && (isSetMessageInfo());
      list.add(present_messageInfo);
      if (present_messageInfo)
        list.add(messageInfo);

      return list.hashCode();
    }

    @Override
    public int compareTo(handleAuth_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetMessageInfo()).compareTo(other.isSetMessageInfo());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetMessageInfo()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messageInfo, other.messageInfo);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("handleAuth_args(");
      boolean first = true;

      sb.append("messageInfo:");
      if (this.messageInfo == null) {
        sb.append("null");
      } else {
        sb.append(this.messageInfo);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (messageInfo != null) {
        messageInfo.validate();
      }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class handleAuth_argsStandardSchemeFactory implements SchemeFactory {
      public handleAuth_argsStandardScheme getScheme() {
        return new handleAuth_argsStandardScheme();
      }
    }

    private static class handleAuth_argsStandardScheme extends StandardScheme<handleAuth_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, handleAuth_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // MESSAGE_INFO
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.messageInfo = new MessageInfo();
                struct.messageInfo.read(iprot);
                struct.setMessageInfoIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, handleAuth_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.messageInfo != null) {
          oprot.writeFieldBegin(MESSAGE_INFO_FIELD_DESC);
          struct.messageInfo.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class handleAuth_argsTupleSchemeFactory implements SchemeFactory {
      public handleAuth_argsTupleScheme getScheme() {
        return new handleAuth_argsTupleScheme();
      }
    }

    private static class handleAuth_argsTupleScheme extends TupleScheme<handleAuth_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, handleAuth_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetMessageInfo()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetMessageInfo()) {
          struct.messageInfo.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, handleAuth_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.messageInfo = new MessageInfo();
          struct.messageInfo.read(iprot);
          struct.setMessageInfoIsSet(true);
        }
      }
    }

  }

  public static class handleAuth_result implements org.apache.thrift.TBase<handleAuth_result, handleAuth_result._Fields>, java.io.Serializable, Cloneable, Comparable<handleAuth_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("handleAuth_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new handleAuth_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new handleAuth_resultTupleSchemeFactory());
    }

    public String success; // required
    public message_error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short)0, "success"),
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          case 1: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(handleAuth_result.class, metaDataMap);
    }

    public handleAuth_result() {
    }

    public handleAuth_result(
      String success,
      message_error error)
    {
      this();
      this.success = success;
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public handleAuth_result(handleAuth_result other) {
      if (other.isSetSuccess()) {
        this.success = other.success;
      }
      if (other.isSetError()) {
        this.error = new message_error(other.error);
      }
    }

    public handleAuth_result deepCopy() {
      return new handleAuth_result(this);
    }

    @Override
    public void clear() {
      this.success = null;
      this.error = null;
    }

    public String getSuccess() {
      return this.success;
    }

    public handleAuth_result setSuccess(String success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public message_error getError() {
      return this.error;
    }

    public handleAuth_result setError(message_error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((String)value);
        }
        break;

      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((message_error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ERROR:
        return getError();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case SUCCESS:
        return isSetSuccess();
      case ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof handleAuth_result)
        return this.equals((handleAuth_result)that);
      return false;
    }

    public boolean equals(handleAuth_result that) {
      if (that == null)
        return false;

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_success = true && (isSetSuccess());
      list.add(present_success);
      if (present_success)
        list.add(success);

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(handleAuth_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("handleAuth_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class handleAuth_resultStandardSchemeFactory implements SchemeFactory {
      public handleAuth_resultStandardScheme getScheme() {
        return new handleAuth_resultStandardScheme();
      }
    }

    private static class handleAuth_resultStandardScheme extends StandardScheme<handleAuth_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, handleAuth_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.success = iprot.readString();
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new message_error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, handleAuth_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          oprot.writeString(struct.success);
          oprot.writeFieldEnd();
        }
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class handleAuth_resultTupleSchemeFactory implements SchemeFactory {
      public handleAuth_resultTupleScheme getScheme() {
        return new handleAuth_resultTupleScheme();
      }
    }

    private static class handleAuth_resultTupleScheme extends TupleScheme<handleAuth_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, handleAuth_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetError()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          oprot.writeString(struct.success);
        }
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, handleAuth_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.success = iprot.readString();
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.error = new message_error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class handleMessageByUsername_args implements org.apache.thrift.TBase<handleMessageByUsername_args, handleMessageByUsername_args._Fields>, java.io.Serializable, Cloneable, Comparable<handleMessageByUsername_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("handleMessageByUsername_args");

    private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField MESSAGE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("messageInfo", org.apache.thrift.protocol.TType.STRUCT, (short)2);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new handleMessageByUsername_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new handleMessageByUsername_argsTupleSchemeFactory());
    }

    public String username; // required
    public MessageInfo messageInfo; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      USERNAME((short)1, "username"),
      MESSAGE_INFO((short)2, "messageInfo");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USERNAME
            return USERNAME;
          case 2: // MESSAGE_INFO
            return MESSAGE_INFO;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.MESSAGE_INFO, new org.apache.thrift.meta_data.FieldMetaData("messageInfo", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, MessageInfo.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(handleMessageByUsername_args.class, metaDataMap);
    }

    public handleMessageByUsername_args() {
    }

    public handleMessageByUsername_args(
      String username,
      MessageInfo messageInfo)
    {
      this();
      this.username = username;
      this.messageInfo = messageInfo;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public handleMessageByUsername_args(handleMessageByUsername_args other) {
      if (other.isSetUsername()) {
        this.username = other.username;
      }
      if (other.isSetMessageInfo()) {
        this.messageInfo = new MessageInfo(other.messageInfo);
      }
    }

    public handleMessageByUsername_args deepCopy() {
      return new handleMessageByUsername_args(this);
    }

    @Override
    public void clear() {
      this.username = null;
      this.messageInfo = null;
    }

    public String getUsername() {
      return this.username;
    }

    public handleMessageByUsername_args setUsername(String username) {
      this.username = username;
      return this;
    }

    public void unsetUsername() {
      this.username = null;
    }

    /** Returns true if field username is set (has been assigned a value) and false otherwise */
    public boolean isSetUsername() {
      return this.username != null;
    }

    public void setUsernameIsSet(boolean value) {
      if (!value) {
        this.username = null;
      }
    }

    public MessageInfo getMessageInfo() {
      return this.messageInfo;
    }

    public handleMessageByUsername_args setMessageInfo(MessageInfo messageInfo) {
      this.messageInfo = messageInfo;
      return this;
    }

    public void unsetMessageInfo() {
      this.messageInfo = null;
    }

    /** Returns true if field messageInfo is set (has been assigned a value) and false otherwise */
    public boolean isSetMessageInfo() {
      return this.messageInfo != null;
    }

    public void setMessageInfoIsSet(boolean value) {
      if (!value) {
        this.messageInfo = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USERNAME:
        if (value == null) {
          unsetUsername();
        } else {
          setUsername((String)value);
        }
        break;

      case MESSAGE_INFO:
        if (value == null) {
          unsetMessageInfo();
        } else {
          setMessageInfo((MessageInfo)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USERNAME:
        return getUsername();

      case MESSAGE_INFO:
        return getMessageInfo();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USERNAME:
        return isSetUsername();
      case MESSAGE_INFO:
        return isSetMessageInfo();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof handleMessageByUsername_args)
        return this.equals((handleMessageByUsername_args)that);
      return false;
    }

    public boolean equals(handleMessageByUsername_args that) {
      if (that == null)
        return false;

      boolean this_present_username = true && this.isSetUsername();
      boolean that_present_username = true && that.isSetUsername();
      if (this_present_username || that_present_username) {
        if (!(this_present_username && that_present_username))
          return false;
        if (!this.username.equals(that.username))
          return false;
      }

      boolean this_present_messageInfo = true && this.isSetMessageInfo();
      boolean that_present_messageInfo = true && that.isSetMessageInfo();
      if (this_present_messageInfo || that_present_messageInfo) {
        if (!(this_present_messageInfo && that_present_messageInfo))
          return false;
        if (!this.messageInfo.equals(that.messageInfo))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_username = true && (isSetUsername());
      list.add(present_username);
      if (present_username)
        list.add(username);

      boolean present_messageInfo = true && (isSetMessageInfo());
      list.add(present_messageInfo);
      if (present_messageInfo)
        list.add(messageInfo);

      return list.hashCode();
    }

    @Override
    public int compareTo(handleMessageByUsername_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUsername()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetMessageInfo()).compareTo(other.isSetMessageInfo());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetMessageInfo()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messageInfo, other.messageInfo);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("handleMessageByUsername_args(");
      boolean first = true;

      sb.append("username:");
      if (this.username == null) {
        sb.append("null");
      } else {
        sb.append(this.username);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("messageInfo:");
      if (this.messageInfo == null) {
        sb.append("null");
      } else {
        sb.append(this.messageInfo);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
      if (messageInfo != null) {
        messageInfo.validate();
      }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class handleMessageByUsername_argsStandardSchemeFactory implements SchemeFactory {
      public handleMessageByUsername_argsStandardScheme getScheme() {
        return new handleMessageByUsername_argsStandardScheme();
      }
    }

    private static class handleMessageByUsername_argsStandardScheme extends StandardScheme<handleMessageByUsername_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, handleMessageByUsername_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // USERNAME
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.username = iprot.readString();
                struct.setUsernameIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // MESSAGE_INFO
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.messageInfo = new MessageInfo();
                struct.messageInfo.read(iprot);
                struct.setMessageInfoIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, handleMessageByUsername_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.username != null) {
          oprot.writeFieldBegin(USERNAME_FIELD_DESC);
          oprot.writeString(struct.username);
          oprot.writeFieldEnd();
        }
        if (struct.messageInfo != null) {
          oprot.writeFieldBegin(MESSAGE_INFO_FIELD_DESC);
          struct.messageInfo.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class handleMessageByUsername_argsTupleSchemeFactory implements SchemeFactory {
      public handleMessageByUsername_argsTupleScheme getScheme() {
        return new handleMessageByUsername_argsTupleScheme();
      }
    }

    private static class handleMessageByUsername_argsTupleScheme extends TupleScheme<handleMessageByUsername_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, handleMessageByUsername_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetUsername()) {
          optionals.set(0);
        }
        if (struct.isSetMessageInfo()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetUsername()) {
          oprot.writeString(struct.username);
        }
        if (struct.isSetMessageInfo()) {
          struct.messageInfo.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, handleMessageByUsername_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.username = iprot.readString();
          struct.setUsernameIsSet(true);
        }
        if (incoming.get(1)) {
          struct.messageInfo = new MessageInfo();
          struct.messageInfo.read(iprot);
          struct.setMessageInfoIsSet(true);
        }
      }
    }

  }

  public static class handleMessageByUsername_result implements org.apache.thrift.TBase<handleMessageByUsername_result, handleMessageByUsername_result._Fields>, java.io.Serializable, Cloneable, Comparable<handleMessageByUsername_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("handleMessageByUsername_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new handleMessageByUsername_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new handleMessageByUsername_resultTupleSchemeFactory());
    }

    public message_error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(handleMessageByUsername_result.class, metaDataMap);
    }

    public handleMessageByUsername_result() {
    }

    public handleMessageByUsername_result(
      message_error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public handleMessageByUsername_result(handleMessageByUsername_result other) {
      if (other.isSetError()) {
        this.error = new message_error(other.error);
      }
    }

    public handleMessageByUsername_result deepCopy() {
      return new handleMessageByUsername_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public message_error getError() {
      return this.error;
    }

    public handleMessageByUsername_result setError(message_error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((message_error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof handleMessageByUsername_result)
        return this.equals((handleMessageByUsername_result)that);
      return false;
    }

    public boolean equals(handleMessageByUsername_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(handleMessageByUsername_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public _Fields fieldForId(int fieldId) {
      return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
      }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("handleMessageByUsername_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class handleMessageByUsername_resultStandardSchemeFactory implements SchemeFactory {
      public handleMessageByUsername_resultStandardScheme getScheme() {
        return new handleMessageByUsername_resultStandardScheme();
      }
    }

    private static class handleMessageByUsername_resultStandardScheme extends StandardScheme<handleMessageByUsername_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, handleMessageByUsername_result struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new message_error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, handleMessageByUsername_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class handleMessageByUsername_resultTupleSchemeFactory implements SchemeFactory {
      public handleMessageByUsername_resultTupleScheme getScheme() {
        return new handleMessageByUsername_resultTupleScheme();
      }
    }

    private static class handleMessageByUsername_resultTupleScheme extends TupleScheme<handleMessageByUsername_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, handleMessageByUsername_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, handleMessageByUsername_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new message_error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

}
