// 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;
/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package biz.paluch.spinach;






/**
 * @author Mark Paluch
 */
public class SslTest {
    public static final String KEYSTORE = "work/keystore.jks";
    public static ClientResources clientResources =  DefaultDisqueClient.getClientResources();
    public static DisqueClient disqueClient = DisqueClient.create(clientResources);

    @Before
    public void before() throws Exception {
        assumeTrue("Assume that stunnel runs on port 7443", Sockets.isOpen(host(), sslPort()));
// 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;

/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package biz.paluch.spinach;






/**
 * @author Mark Paluch
 */
public class SslTest {
    public static final String KEYSTORE = "work/keystore.jks";
    public static ClientResources clientResources =  DefaultDisqueClient.getClientResources();
    public static DisqueClient disqueClient = DisqueClient.create(clientResources);

    @Before
    public void before() throws Exception {
        assumeTrue("Assume that stunnel runs on port 7443", Sockets.isOpen(host(), sslPort()));
        assertThat(new File(KEYSTORE)).exists();