@Test
    public void TestCustomConnectionParameters() {
        RequestConfig reqC = RequestConfig.custom()
                .setSocketTimeout(10) // 1/100 of a second in miliseconds
                .setConnectTimeout(10) // 1/100 of a second in miliseconds
            .build();
        HttpClient client = HttpClients.custom()
                .setDefaultRequestConfig(reqC)
            .build();
        
        Gateway beanstream = new Gateway("v1", 300200578,
                "4BaD82D9197b4cc4b70a221911eE9f70", // payments API passcode
                "D97D3BE1EE964A6193D17A571D9FBC80", // profiles API passcode
                "4e6Ff318bee64EA391609de89aD4CF5d");// reporting API passcode
        
        beanstream.setCustomHttpsClient(client);
        
        
        // this should time out
        CardPaymentRequest req = new CardPaymentRequest();
        req.setAmount(100.00)
            .setOrderNumber(getRandomOrderId("test"));
        req.getCard()
                .setName("John Doe")
                .setNumber("5100000010001004")
                .setExpiryMonth("12")
                .setExpiryYear("18")
                .setCvd("123");
        
        boolean timedOut = false;
        try {

            PaymentResponse response = beanstream.payments().makePayment(req);

        } catch (BeanstreamApiException ex) {
            if ("Connection error".equalsIgnoreCase( ex.getMessage()) )
                timedOut = true;
        }
    }