code: public void setTCPBufferSize(final int size) throws ClientException {
          logger.debug("Changing local TCP buffer setting to " + size);
  
          gSession.TCPBufferSize = size;
  
          SocketOperator op = new SocketOperator() {
                  public void operate(SocketBox s) throws Exception {
  
                      // synchronize to prevent race condition against
                      // the socket initialization code that also sets
                      // TCP buffer (GridFTPActiveConnectTask)
                      synchronized (s) {
                          logger.debug(
                                       "Changing local socket's TCP buffer to " + size);
                          Socket mySocket = s.getSocket();
                          if (mySocket != null) {
                              mySocket.setReceiveBufferSize(size);
                              mySocket.setSendBufferSize(size);
                          } else {
                              logger.debug(
                                           "the socket is null. probably being initialized");
                          }
                      }
                  }
          };
          try {
              socketPool.applyToAll(op);
          } catch (Exception e) {
              ClientException ce =
                  new ClientException(ClientException.SOCKET_OP_FAILED);
              ce.setRootCause(e);
              throw ce;
          }
      }
docs: This method needs to be called BEFORE the local socket(s) get created.
  In other words, before setActive(), setPassive(), get(), put(), etc.