// Path: src/test/java/biz/paluch/spinach/TestSettings.java
// public static String host() {
//     return System.getProperty("host", "localhost");
// }
// 
// Path: src/test/java/biz/paluch/spinach/TestSettings.java
// public static int sslPort() {
//     return Integer.valueOf(System.getProperty("sslport", "7443"));
// }
// 
// Path: src/test/java/biz/paluch/spinach/support/DefaultDisqueClient.java
// public class DefaultDisqueClient {
// 
//     public final static DefaultDisqueClient instance = new DefaultDisqueClient();
// 
//     private DisqueClient disqueClient;
//     private ClientResources clientResources;
// 
//     public DefaultDisqueClient() {
//         clientResources = TestClientResources.create();
//         disqueClient = DisqueClient.create(clientResources, DisqueURI.Builder.disque(TestSettings.host(), TestSettings.port())
//                 .build());
//         Runtime.getRuntime().addShutdownHook(new Thread() {
//             @Override
//             public void run() {
//                 FastShutdown.shutdown(disqueClient);
//             }
//         });
//     }
// 
//     /**
//      * Do not close the client.
//      * 
//      * @return the default disque client for the tests.
//      */
//     public static DisqueClient get() {
//         instance.disqueClient.setDefaultTimeout(60, TimeUnit.SECONDS);
//         return instance.disqueClient;
//     }
// 
//     /**
//      * Do not close the client resources.
//      * @return the default client resources for the tests.
//      */
//     public static ClientResources getClientResources() {
//         return instance.clientResources;
//     }
// }
// 
// Path: src/main/java/biz/paluch/spinach/api/sync/DisqueCommands.java
// public interface DisqueCommands<K, V> extends DisqueJobCommands<K, V>, DisqueQueueCommands<K, V>, DisqueServerCommands<K, V>,
//         DisqueClusterCommands<K, V> {
// 
//     /**
//      * Authenticate to the server.
//      *
//      * @param password the password
//      * @return String simple-string-reply
//      */
//     String auth(String password);
// 
//     /**
//      * Close the connection. The connection will become not usable anymore as soon as this method was called.
//      */
//     void close();
// 
//     /**
//      *
//      * @return the underlying connection.
//      */
//     DisqueConnection<K, V> getConnection();
// 
//     /**
//      *
//      * @return true if the connection is open (connected and not closed).
//      */
//     boolean isOpen();
// 
//     /**
//      * Ping the server.
//      *
//      * @return simple-string-reply
//      */
//     String ping();
// 
//     /**
//      * Close the connection.
//      * 
//      * @return String simple-string-reply always OK.
//      */
//     String quit();
// 
//     /**
//      * Set the default timeout for operations.
//      *
//      * @param timeout the timeout value
//      * @param unit the unit of the timeout value
//      */
//     void setTimeout(long timeout, TimeUnit unit);
// }
// 
// Path: src/test/java/biz/paluch/spinach/support/FastShutdown.java
// public class FastShutdown {
// 
//     /**
//      * Shut down a {@link AbstractRedisClient} with a timeout of 10ms.
//      * 
//      * @param redisClient
//      */
//     public static void shutdown(AbstractRedisClient redisClient) {
//         redisClient.shutdown(10, 10, TimeUnit.MILLISECONDS);
//     }
// 
//     /**
//      * Shut down a {@link ClientResources} client with a timeout of 10ms.
//      *
//      * @param clientResources
//      */
//     public static void shutdown(ClientResources clientResources) {
//         clientResources.shutdown(10, 10, TimeUnit.MILLISECONDS);
//     }
// }


import com.lambdaworks.redis.ClientOptions;
import com.lambdaworks.redis.JavaRuntime;
import com.lambdaworks.redis.RedisConnectionException;
import com.lambdaworks.redis.resource.ClientResources;
import static biz.paluch.spinach.TestSettings.host;
import static biz.paluch.spinach.TestSettings.sslPort;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
import java.io.File;
import biz.paluch.spinach.support.DefaultDisqueClient;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import biz.paluch.spinach.api.sync.DisqueCommands;
import biz.paluch.spinach.support.FastShutdown;
        FastShutdown.shutdown(disqueClient);
    }

    @Test
    public void regularSsl() throws Exception {
        DisqueURI disqueUri = DisqueURI.Builder.disque(host(), sslPort()).withSsl(true).withVerifyPeer(false).build();

        DisqueCommands<String, String> connection = disqueClient.connect(disqueUri).sync();

        assertThat(connection.ping()).isEqualTo("PONG");

        connection.close();
    }

    @Test
    public void pingBeforeActivate() throws Exception {
        DisqueURI disqueUri = DisqueURI.Builder.disque(host(), sslPort()).withSsl(true).withVerifyPeer(false).build();
        disqueClient.setOptions(new ClientOptions.Builder().pingBeforeActivateConnection(true).build());

        DisqueCommands<String, String> connection = disqueClient.connect(disqueUri).sync();

        assertThat(connection.ping()).isEqualTo("PONG");

        connection.close();
    }

    @Test
    public void regularSslWithReconnect() throws Exception {
        DisqueURI disqueUri = DisqueURI.Builder.disque(host(), sslPort()).withSsl(true).withVerifyPeer(false).build();

// Path: src/test/java/biz/paluch/spinach/TestSettings.java
// public static String host() {
//     return System.getProperty("host", "localhost");
// }
// 
// Path: src/test/java/biz/paluch/spinach/TestSettings.java
// public static int sslPort() {
//     return Integer.valueOf(System.getProperty("sslport", "7443"));
// }
// 
// Path: src/test/java/biz/paluch/spinach/support/DefaultDisqueClient.java
// public class DefaultDisqueClient {
// 
//     public final static DefaultDisqueClient instance = new DefaultDisqueClient();
// 
//     private DisqueClient disqueClient;
//     private ClientResources clientResources;
// 
//     public DefaultDisqueClient() {
//         clientResources = TestClientResources.create();
//         disqueClient = DisqueClient.create(clientResources, DisqueURI.Builder.disque(TestSettings.host(), TestSettings.port())
//                 .build());
//         Runtime.getRuntime().addShutdownHook(new Thread() {
//             @Override
//             public void run() {
//                 FastShutdown.shutdown(disqueClient);
//             }
//         });
//     }
// 
//     /**
//      * Do not close the client.
//      * 
//      * @return the default disque client for the tests.
//      */
//     public static DisqueClient get() {
//         instance.disqueClient.setDefaultTimeout(60, TimeUnit.SECONDS);
//         return instance.disqueClient;
//     }
// 
//     /**
//      * Do not close the client resources.
//      * @return the default client resources for the tests.
//      */
//     public static ClientResources getClientResources() {
//         return instance.clientResources;
//     }
// }
// 
// Path: src/main/java/biz/paluch/spinach/api/sync/DisqueCommands.java
// public interface DisqueCommands<K, V> extends DisqueJobCommands<K, V>, DisqueQueueCommands<K, V>, DisqueServerCommands<K, V>,
//         DisqueClusterCommands<K, V> {
// 
//     /**
//      * Authenticate to the server.
//      *
//      * @param password the password
//      * @return String simple-string-reply
//      */
//     String auth(String password);
// 
//     /**
//      * Close the connection. The connection will become not usable anymore as soon as this method was called.
//      */
//     void close();
// 
//     /**
//      *
//      * @return the underlying connection.
//      */
//     DisqueConnection<K, V> getConnection();
// 
//     /**
//      *
//      * @return true if the connection is open (connected and not closed).
//      */
//     boolean isOpen();
// 
//     /**
//      * Ping the server.
//      *
//      * @return simple-string-reply
//      */
//     String ping();
// 
//     /**
//      * Close the connection.
//      * 
//      * @return String simple-string-reply always OK.
//      */
//     String quit();
// 
//     /**
//      * Set the default timeout for operations.
//      *
//      * @param timeout the timeout value
//      * @param unit the unit of the timeout value
//      */
//     void setTimeout(long timeout, TimeUnit unit);
// }
// 
// Path: src/test/java/biz/paluch/spinach/support/FastShutdown.java
// public class FastShutdown {
// 
//     /**
//      * Shut down a {@link AbstractRedisClient} with a timeout of 10ms.
//      * 
//      * @param redisClient
//      */
//     public static void shutdown(AbstractRedisClient redisClient) {
//         redisClient.shutdown(10, 10, TimeUnit.MILLISECONDS);
//     }
// 
//     /**
//      * Shut down a {@link ClientResources} client with a timeout of 10ms.
//      *
//      * @param clientResources
//      */
//     public static void shutdown(ClientResources clientResources) {
//         clientResources.shutdown(10, 10, TimeUnit.MILLISECONDS);
//     }
// }


// Path: src/test/java/biz/paluch/spinach/SslTest.java
import com.lambdaworks.redis.ClientOptions;
import com.lambdaworks.redis.JavaRuntime;
import com.lambdaworks.redis.RedisConnectionException;
import com.lambdaworks.redis.resource.ClientResources;
import static biz.paluch.spinach.TestSettings.host;
import static biz.paluch.spinach.TestSettings.sslPort;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
import java.io.File;
import biz.paluch.spinach.support.DefaultDisqueClient;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import biz.paluch.spinach.api.sync.DisqueCommands;
import biz.paluch.spinach.support.FastShutdown;

        FastShutdown.shutdown(disqueClient);
    }

    @Test
    public void regularSsl() throws Exception {
        DisqueURI disqueUri = DisqueURI.Builder.disque(host(), sslPort()).withSsl(true).withVerifyPeer(false).build();

        DisqueCommands<String, String> connection = disqueClient.connect(disqueUri).sync();

        assertThat(connection.ping()).isEqualTo("PONG");

        connection.close();
    }

    @Test
    public void pingBeforeActivate() throws Exception {
        DisqueURI disqueUri = DisqueURI.Builder.disque(host(), sslPort()).withSsl(true).withVerifyPeer(false).build();
        disqueClient.setOptions(new ClientOptions.Builder().pingBeforeActivateConnection(true).build());

        DisqueCommands<String, String> connection = disqueClient.connect(disqueUri).sync();

        assertThat(connection.ping()).isEqualTo("PONG");

        connection.close();
    }

    @Test
    public void regularSslWithReconnect() throws Exception {
        DisqueURI disqueUri = DisqueURI.Builder.disque(host(), sslPort()).withSsl(true).withVerifyPeer(false).build();

        DisqueCommands<String, String> connection = disqueClient.connect(disqueUri).sync();