api/java/src/main/java/com/navercorp/redis/cluster/connection/RedisConnectionAsync.java
public void sendCommand(final Command cmd, final byte[]... args) {
        log.trace("[RedisConnection] Command={} {}", cmd.name(), toStringArgs(args));
        RedisProtocol.sendCommand(outputStream, cmd, args);
        try {
            outputStream.flush();
        } catch (IOException e) {
            throw new JedisConnectionException(e);
        }
        
        final SettableFuture<byte[]> future = SettableFuture.create();
        
        byte [] cmdBytes = new byte[outputBuf.readableBytes()]; 
        outputBuf.readBytes(cmdBytes);
        outputBuf.discardSomeReadBytes();
        
        vc.request(cmdBytes, activeTimeout, new RequestCallback() {
            @Override
            public void onResponse(byte[] response, StatusCode statusCode) {
                switch (statusCode) {
                case OK:
                    future.set(response);
                    break;
                    
                case CONNECTION_ERROR:
                    future.setException(new GatewayException("Connection error"));
                    break;
                case INTERNAL_ERROR:
                    future.setException(new GatewayException("Internal error"));
                    break;
                case NO_AVAILABLE_CONNECTION:
                    future.setException(new GatewayException("no available connection"));
                    break;
                case SHUTDOWN:
                    future.setException(new GatewayException("already closed"));
                    break;
                case TIMEOUT:
                    future.setException(new GatewayException("Timeout"));
                    break;
                }
            }
        });
        
        pipelinedFutures.add(future);
    }
public void sendCommand(final Command cmd, final byte[]... args) {
        log.trace("[RedisConnection] Command={} {}", cmd.name(), toStringArgs(args));
        RedisProtocol.sendCommand(outputStream, cmd, args);
        try {
            outputStream.flush();
        } catch (IOException e) {
            throw new JedisConnectionException(e);
        }
        
        final SettableFuture<byte[]> future = SettableFuture.create();
        
        byte [] cmdBytes = new byte[outputBuf.readableBytes()]; 
        outputBuf.readBytes(cmdBytes);
        outputBuf.discardSomeReadBytes();
        
        vc.request(cmdBytes, activeTimeout, new RequestCallback() {
            @Override
            public void onResponse(byte[] response, StatusCode statusCode) {
                switch (statusCode) {
                case OK:
                    future.set(response);
                    break;
                    
                case CONNECTION_ERROR:
                    future.setException(new GatewayException("Connection error"));
                    break;
                case INTERNAL_ERROR:
                    future.setException(new GatewayException("Internal error"));
                    break;
                case NO_AVAILABLE_CONNECTION:
                    future.setException(new GatewayException("no available connection"));
                    break;
                case SHUTDOWN:
                    future.setException(new GatewayException("already closed"));
                    break;
                case TIMEOUT:
                    future.setException(new GatewayException("Timeout"));
                    break;
                }
            }
        });
        
        pipelinedFutures.add(future);
    }
Send command.

@param cmd  the cmd
@param args the args
@return the redis connection