public static void main(String[] args) { try { Socket s1 = new Socket("127.0.0.1", 57643); InputStream is = s1.getInputStream(); DataInputStream dis = new DataInputStream(is); System.out.println(dis.readUTF()); OutputStream os = s1.getOutputStream(); DataOutputStream dos = new DataOutputStream(os); dos.writeUTF("Oh my gosh..."); dis.close(); is.close(); dos.close(); os.close(); s1.close(); } catch (ConnectException connExc) { connExc.printStackTrace(); System.out.println("Server connection failed"); } catch (IOException ioExc) { ioExc.printStackTrace(); } }
/** * 方法名:httpRequest</br> 详述:发送http请求</br> 开发人员:souvc </br> 创建时间:2016-1-5 </br> * * @param requestUrl * @param requestMethod * @param outputStr * @return 说明返回值含义 * @throws 说明发生此异常的条件 */ private static JsonNode httpRequest(String requestUrl, String requestMethod, String outputStr) { StringBuffer buffer = new StringBuffer(); JsonNode josnNode = null; JSONObject jsonObject = null; try { URL url = new URL(requestUrl); HttpsURLConnection httpUrlConn = (HttpsURLConnection) url.openConnection(); httpUrlConn.setRequestMethod("GET"); httpUrlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); httpUrlConn.setDoOutput(true); httpUrlConn.setDoInput(true); httpUrlConn.setUseCaches(false); System.setProperty("sun.net.client.defaultConnectTimeout", "30000"); // 连接超时30秒 System.setProperty("sun.net.client.defaultReadTimeout", "30000"); // 读取超时30秒 httpUrlConn.connect(); InputStream inputStream = httpUrlConn.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8"); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String str = null; while ((str = bufferedReader.readLine()) != null) { buffer.append(str); } josnNode = new ObjectMapper().readTree(buffer.toString()); bufferedReader.close(); inputStreamReader.close(); inputStream.close(); inputStream = null; httpUrlConn.disconnect(); } catch (ConnectException ce) { ce.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return josnNode; }
/** Program Entry Point. */ public static void main(String args[]) { // Set up log Log log = new Log(); log.setLogName("Client"); // Connection object listening on 4001 Connection conn = new ConnectionImpl2(4001); InetAddress addr; // will hold address of host to connect to try { // get address of local host and connect addr = InetAddress.getLocalHost(); conn.connect(addr, 5555); // send two messages to server conn.send("Client: Hello Server! Are you there?"); conn.send("Client: Hi again!"); // write a message in the log and close the connection Log.writeToLog("Client is now closing the connection!", "TestApplication"); conn.close(); } catch (ConnectException e) { Log.writeToLog(e.getMessage(), "TestApplication"); e.printStackTrace(); } catch (UnknownHostException e) { Log.writeToLog(e.getMessage(), "TestApplication"); e.printStackTrace(); } catch (IOException e) { Log.writeToLog(e.getMessage(), "TestApplication"); e.printStackTrace(); } System.out.println("CLIENT TEST FINISHED"); Log.writeToLog("CLIENT TEST FINISHED", "TestApplication"); }
private boolean txt2Pdf(File inputFile, File outputFile, Charset inputFileCharset) { // // 先将txt转成odt // String fileName = inputFile.getAbsolutePath(); // if (fileName.endsWith(".txt")) { BufferedReader bufferedReader = null; try { // 判断原始txt文件的编码格式,获取响应的文件读入 bufferedReader = new BufferedReader( new InputStreamReader(new FileInputStream(inputFile), inputFileCharset)); // 将txt内容直接生成pdf Document document = new Document(); BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); Font font_normal = new Font(bfChinese, 10, Font.NORMAL); // 设置字体大小 document.setPageSize(PageSize.A4); // 设置页面大小 if (!outputFile.exists()) { outputFile.createNewFile(); } try { PdfWriter.getInstance(document, new FileOutputStream(outputFile)); document.open(); } catch (Exception e) { e.printStackTrace(); } String content = null; while ((content = bufferedReader.readLine()) != null) { document.add(new Paragraph(content, font_normal)); } document.close(); bufferedReader.close(); return true; } catch (ConnectException cex) { cex.printStackTrace(); // System.out.println("转换失败!"); return false; } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } catch (DocumentException e) { e.printStackTrace(); return false; } finally { // close the connection if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } } } // } }
public void run() { Log.v(TAG, "entering client thread --> "); String message = null; try { Log.v(TAG, "server IP:" + mServerIP + ", SERVER_PORT" + SERVER_PORT); mSocket = new Socket(mServerIP, SERVER_PORT); mReader = new BufferedReader(new InputStreamReader(mSocket.getInputStream())); mWriter = new PrintWriter( new BufferedWriter(new OutputStreamWriter(mSocket.getOutputStream())), true); if (mHandler != null) { mHandler.sendMessage(Message.obtain(null, MSG_ON_SERVER_CONNECTED, message)); } while (true) { Log.v(TAG, "try to read from socket --> "); if (mSocket.isConnected() && !mSocket.isInputShutdown()) { message = mReader.readLine(); Log.v(TAG, "Read Message: " + message); if (message == null) { Log.v(TAG, "remote socket closed"); break; } else { if (mHandler != null) { mHandler.sendMessage(Message.obtain(null, MSG_ON_MESSAGE_ARRIVED, message)); } } } else { Log.v(TAG, "disconnected ir input shutdown, so quit!: "); break; } } } catch (UnknownHostException e) { e.printStackTrace(); } catch (ConnectException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { if (mReader != null) { mReader.close(); mReader = null; } if (mWriter != null) { mWriter.close(); mWriter = null; } mSocket = null; } catch (IOException e) { e.printStackTrace(); } Log.v(TAG, "exit client thread --> "); }
/** Program Entry Point. */ public static void main(String args[]) { // Set up log Log log = new Log(); log.setLogName("Client"); // Connection object listening on 4001 Connection conn = new ConnectionImpl(4001); InetAddress addr; // will hold address of host to connect to try { // get address of local host and connect addr = InetAddress.getLocalHost(); // 78.91.16.205 // addr = InetAddress.getByAddress(new byte[] { (byte) 78,(byte) 91, (byte) 23, (byte) 32 } // ); conn.connect(addr, 5555); // send two messages to server String[] msgs = new String[20]; for (int i = 0; i < msgs.length; i++) { msgs[i] = "m" + i; } for (String msg : msgs) { conn.send(msg); } // conn.send("Client: Hello Server! Are you there?"); // conn.send("Client: Hi again!"); // write a message in the log and close the connection Log.writeToLog("Client is now closing the connection!", "TestApplication"); // System.out.println("##### close()"); conn.close(); // System.out.println("#### close();"); } catch (ConnectException e) { // Log.writeToLog(e.getMessage(),"TestApplication"); e.printStackTrace(); } catch (UnknownHostException e) { // Log.writeToLog(e.getMessage(),"TestApplication"); e.printStackTrace(); } catch (IOException e) { Log.writeToLog(e.getMessage(), "TestApplication"); e.printStackTrace(); } System.out.println("CLIENT TEST FINISHED"); Log.writeToLog("CLIENT TEST FINISHED", "TestApplication"); }
public Bucket openBucketConnectionNoPass() { try { randomConnectionUtility = randomConnectionBuilder.constructRandomConnection(); bucket = randomConnectionUtility.getCluster().openBucket(bucketid, 5, TimeUnit.SECONDS); } catch (ConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); } return bucket; }
public static boolean isPortOpen(final String ip, final int port, final int timeout) { try { Socket socket = new Socket(); socket.connect(new InetSocketAddress(ip, port), timeout); socket.close(); return true; } catch (ConnectException ce) { ce.printStackTrace(); return false; } catch (Exception ex) { ex.printStackTrace(); return false; } }
public void setup() { size(640, 480); ThinkGearSocket neuroSocket = new ThinkGearSocket(this); try { neuroSocket.start(); } catch (ConnectException e) { e.printStackTrace(); } smooth(); font = loadFont("MyriadPro-Regular-24.vlw"); textFont(font); frameRate(25); cap = new Capture(this, width, height); noStroke(); }
@Test public void testTypes() throws IOException, NoSuchElementException { if (url == null) return; WFS_1_0_0_DataStore wfs; try { wfs = WFSDataStoreReadTest.getDataStore(url); } catch (ConnectException e) { e.printStackTrace(System.err); return; } catch (UnknownHostException e) { e.printStackTrace(System.err); return; } catch (NoRouteToHostException e) { e.printStackTrace(System.err); return; } String types[] = wfs.getTypeNames(); String typeName = "unknown"; for (int i = 0; i < types.length; i++) { typeName = types[i]; if (typeName.equals("topp:geometrytype")) continue; SimpleFeatureType type = wfs.getSchema(typeName); type.getTypeName(); type.getName().getNamespaceURI(); SimpleFeatureSource source = wfs.getFeatureSource(typeName); source.getBounds(); SimpleFeatureCollection features = source.getFeatures(); features.getBounds(); features.getSchema(); // features.getFeatureType(); Query query = new Query(typeName, Filter.INCLUDE, 20, Query.ALL_NAMES, "work already"); features = source.getFeatures(query); features.size(); SimpleFeatureIterator iterator = features.features(); try { while (iterator.hasNext()) { SimpleFeature feature = (SimpleFeature) iterator.next(); } } finally { iterator.close(); } } }
/** Program Entry Point. */ public static void main(String args[]) { // Set up log Log log = new Log(); log.setLogName("Client"); // Connection object listening on 4001 Connection conn = new ConnectionImpl(4001); InetAddress addr; // will hold address of host to connect to try { // get address of local host and connect addr = InetAddress.getLocalHost(); conn.connect(addr, 5555); // send two messages to server for (int i = 0; i < 20; i++) { conn.send("Packet " + i); } int rec = 0; try { while (rec < 20) { String msg = conn.receive(); Log.writeToLog("Message got through to client: " + msg, "TestClient"); rec++; } } catch (EOFException e) { Log.writeToLog("Got close request (EOFException), closing.", "TestClient"); conn.close(); } // write a message in the log and close the connection Log.writeToLog("Client is now closing the connection!", "TestApplication"); conn.close(); } catch (ConnectException e) { Log.writeToLog(e.getMessage(), "TestApplication"); e.printStackTrace(); } catch (UnknownHostException e) { Log.writeToLog(e.getMessage(), "TestApplication"); e.printStackTrace(); } catch (IOException e) { Log.writeToLog(e.getMessage(), "TestApplication"); e.printStackTrace(); } System.out.println("CLIENT TEST FINISHED"); Log.writeToLog("CLIENT TEST FINISHED", "TestApplication"); }
@Test public void testSingleType() throws IOException, NoSuchElementException { if (url == null) return; WFS_1_0_0_DataStore wfs; try { wfs = WFSDataStoreReadTest.getDataStore(url); } catch (ConnectException e) { e.printStackTrace(System.err); return; } catch (UnknownHostException e) { e.printStackTrace(System.err); return; } catch (NoRouteToHostException e) { e.printStackTrace(System.err); return; } String typeName = "tiger:poi"; SimpleFeatureType type = wfs.getSchema(typeName); type.getTypeName(); type.getName().getNamespaceURI(); SimpleFeatureSource source = wfs.getFeatureSource(typeName); source.getBounds(); SimpleFeatureCollection features = source.getFeatures(); features.getBounds(); features.getSchema(); // features.getFeatureType(); Query query = new Query(typeName, Filter.INCLUDE, 20, Query.ALL_NAMES, "work already"); features = source.getFeatures(query); features.size(); SimpleFeatureIterator iterator = features.features(); while (iterator.hasNext()) { SimpleFeature feature = iterator.next(); } iterator.close(); }
private static String getSearchedAnime(String animeToSearch) { if (token == null) { try { ConnectAndGetToken(); } catch (ConnectException e) { MAMUtil.writeLog(e); e.printStackTrace(); } catch (UnknownHostException e) { MAMUtil.writeLog(e); e.printStackTrace(); } } URL url; // The URL to read HttpURLConnection conn = null; // The actual connection to the web page BufferedReader rr; // Used to read results from the web page String line; // An individual line of the web page HTML String result = ""; // A long string containing all the HTML try { String animeQuery = URLEncoder.encode( animeToSearch .replace(".", "\\.") .replace("/", "\\ ") .replace("-", "\\-") .replace("!", "\\!"), "UTF-8"); url = new URL(ANI_BASEURL + SEARCH + animeQuery + "?access_token=" + ConnectionManager.token); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("GET"); conn.setRequestProperty("User-Agent", "My Anime Manager"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); rr = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); while ((line = rr.readLine()) != null) result += line + "\r\n"; rr.close(); } catch (Exception e) { try { if (conn.getResponseCode() == 401) { System.out.println("Errore 401"); System.out.println("Token scaduto, richiesta nuovo token"); ConnectionManager.tokenExpired = true; attempts++; if (attempts > 5) { ConnectAndGetToken(); AnimeSearch(animeToSearch); attempts = 0; } else JOptionPane.showMessageDialog( AnimeIndex.frame, "Errore durante la connessione! Potrebbe dipendere dalla tua connessione o dal sito di Anilist.", "Errore!", JOptionPane.ERROR_MESSAGE); } else { e.printStackTrace(); MAMUtil.writeLog(e); } } catch (IOException e1) { MAMUtil.writeLog(e1); e1.printStackTrace(); } } result = StringEscapeUtils.unescapeJava(result); return result; }
public static boolean replicate( String rootDir, String filePath, String clientName, ServerDetails dest) throws ConnectException { boolean pushSuccess = false; Logger.Log("Root Dir :" + rootDir); Logger.Log("File Path:" + filePath); Logger.Log("Client Name :" + clientName); rootDir = Utilities.getFormattedDir(rootDir); filePath = Utilities.getFormattedFilePath(filePath); try { SocketAddress address = new InetSocketAddress(dest.getIp(), dest.getPort()); Socket tcpSocket = new Socket(); tcpSocket.connect(address, 4000); File file = new File(rootDir + filePath); FileInputStream fileInputStream = new FileInputStream(file); DataOutputStream socketOutputStream = new DataOutputStream(tcpSocket.getOutputStream()); DataInputStream socketInputStream = new DataInputStream(tcpSocket.getInputStream()); long startTime = System.currentTimeMillis(); String md5 = MD5Checksum.getMD5Checksum(rootDir + filePath); // Step 1: prepare the destination for upload String request = IConstants.REPLICATE + IConstants.DELIMITER + clientName + IConstants.DELIMITER + filePath + IConstants.DELIMITER + md5; Logger.Log("Upload Request :" + request); socketOutputStream.writeInt(request.length()); socketOutputStream.writeBytes(request); // Step 2: Confirm and upload file int opcode = socketInputStream.readInt(); if (opcode == IConstants.OK) { byte[] buffer = new byte[BUFFER_SIZE]; int read; int readTotal = 0; while ((read = fileInputStream.read(buffer)) != -1) { socketOutputStream.write(buffer, 0, read); readTotal += read; } socketInputStream.close(); socketOutputStream.close(); long endTime = System.currentTimeMillis(); System.out.println(readTotal + " bytes written in " + (endTime - startTime) + " ms."); pushSuccess = true; } else if (opcode == IConstants.NO_ACTION) { Logger.Log("UPLOAD NOT REQUIRED"); } fileInputStream.close(); } catch (ConnectException ce) { ce.printStackTrace(); System.out.println("FileUploader.replicate() Connection Failed"); throw ce; } catch (SocketTimeoutException sto) { throw new ConnectException(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return pushSuccess; }
private HttpResponse phaRequestPart1( String reqMeth, String reletivePath, Object queryString, String phaToken, String phaTokenSecret, Object requestBody, // String or byte[] String contentType, Map<String, Object> options) throws IndivoClientException { String consumerToken = null; String consumerSecret = null; String foreignURL = null; Object indivoInstallation = options.get("indivoInstallation"); if (indivoInstallation != null) { if (!(indivoInstallation instanceof String[])) { throw new IndivoClientException( "indivoInstallation option must be of type String[] with lenght == 3. Was: " + indivoInstallation.getClass().getName()); } String[] indivoInstallation0 = (String[]) indivoInstallation; if (indivoInstallation0.length != 3) { throw new IndivoClientException( "indivoInstallation option must be a String array with length 3. Length is: " + indivoInstallation0.length); } foreignURL = indivoInstallation0[0]; consumerToken = indivoInstallation0[1]; consumerSecret = indivoInstallation0[2]; } logger.info( "consumerToken, consumerSecret, foreignURL: " + consumerToken + ", " + consumerSecret + ", " + foreignURL); String displayQS = "null"; if (queryString != null) { displayQS = queryString.getClass().getName() + " " + queryString; } ; logger.info( "reletivePath, queryString, requestXmlOrParams: " + reletivePath + ", " + displayQS + '\n' + requestBody + "\n\n"); String queryString0; if (queryString == null || ((queryString instanceof String) && ((String) queryString).length() == 0)) { queryString0 = ""; } else if (queryString instanceof String) { String qsString = (String) queryString; if (qsString.indexOf('=') < 1) { throw new IndivoClientException( "unexpected queryString, did not have any key/value delimiter of '=': " + queryString); } queryString0 = qsString; logger.info("queryString0 = qsString = " + qsString); } else if (queryString instanceof Map) { StringBuffer qsBuff = new StringBuffer(); Map qsMap = (Map) queryString; Iterator iter = qsMap.keySet().iterator(); while (iter.hasNext()) { if (qsBuff.length() > 0) { qsBuff.append('&'); } Object keyObj = iter.next(); if (!(keyObj instanceof String)) { throw new IndivoClientException( "queryString map key of unexpected type: " + keyObj.getClass().getName() + " -- " + keyObj); } String key = (String) keyObj; Object valueObj = qsMap.get(key); try { if (valueObj instanceof String) { qsBuff.append( URLEncoder.encode(key, "UTF-8") + '=' + URLEncoder.encode((String) valueObj, "UTF-8")); } else if (valueObj instanceof String[]) { String[] valueArr = (String[]) valueObj; for (int ii = 0; ii < valueArr.length; ii++) { qsBuff.append( URLEncoder.encode(key, "UTF-8") + '=' + URLEncoder.encode(valueArr[ii], "UTF-8")); } } else { throw new IndivoClientException( "queryString map value of unexpected type: " + valueObj.getClass().getName() + " -- " + valueObj); } } catch (java.io.UnsupportedEncodingException uee) { throw new IndivoClientException(uee); } } queryString0 = qsBuff.toString(); } else { throw new IndivoClientException( "queryString not String or Map, type is: " + queryString.getClass().getName()); } String baseURL0 = defaultBaseURL; if (foreignURL != null) { baseURL0 = foreignURL; } String consumerKey0 = defaultConsumerKey; String consumerSecret0 = defaultConsumerSecret; if (consumerToken != null) { consumerKey0 = consumerToken; consumerSecret0 = consumerSecret; } logger.info( " -- baseURL0: " + baseURL0 + " -- reletivePath: " + reletivePath + " -- queryString: " + queryString0); String phaURLString = baseURL0 + reletivePath; if (queryString0.length() > 0) { phaURLString += "?" + queryString0; } /* FIXME temp for test*/ // System.out.println(phaURLString); if (requestBody != null) { System.out.println(requestBody); // } if (requestBody != null) { if (requestBody instanceof String) { if (((String) requestBody).length() > 0) { if (contentType == null || contentType.length() == 0) { throw new IndivoClientException("contentType must be provided for request body"); } } } else if ((requestBody instanceof Byte[] && ((Byte[]) requestBody).length > 0) || (requestBody instanceof byte[] && ((byte[]) requestBody).length > 0)) { if (contentType == null || contentType.length() == 0) { throw new IndivoClientException("contentType must be provided for request body"); } } else { throw new IndivoClientException( "requestBody must be either String or Byte[] or byte[], was: " + requestBody.getClass().getName()); } } else if (contentType != null && contentType.length() > 0) { throw new IndivoClientException("content type provided without requestBody: " + contentType); } HttpUriRequest hcRequest = null; // String requestXmlOrParams0 = null; if (requestBody == null) { requestBody = ""; } logger.info("reqMeth: " + reqMeth); try { if (reqMeth.equals("PUT") || reqMeth.equals("POST")) { if (reqMeth.equals("PUT")) { hcRequest = new HttpPut(phaURLString); } else { hcRequest = new HttpPost(phaURLString); } byte[] requestBodyB = null; if (requestBody instanceof String) { String requestBodyStr = (String) requestBody; if (requestBodyStr.startsWith("<?xml")) { String[] parsedProlog = getEncoding(requestBodyStr); if (parsedProlog.length == 3 && (!parsedProlog[1].toUpperCase().equals("UTF-8"))) { requestBodyStr = parsedProlog[0] + "UTF-8" + parsedProlog[1]; logger.info("changing prolog from: " + parsedProlog[1] + " to: " + "UTF-8"); requestBodyStr = parsedProlog[0] + "UTF-8" + parsedProlog[2]; } } // System.out.println("requestBodyStr: " + requestBodyStr); requestBodyB = requestBodyStr.getBytes("UTF-8"); } else if (requestBody instanceof byte[]) { requestBodyB = (byte[]) requestBody; } else { // requestBody instanceof Byte[] requestBodyB = new byte[((Byte[]) requestBody).length]; for (int ii = 0; ii < ((Byte[]) requestBody).length; ii++) { requestBodyB[ii] = ((Byte[]) requestBody)[ii]; } } ByteArrayEntity bae = new ByteArrayEntity(requestBodyB); bae.setContentType(contentType); ((HttpEntityEnclosingRequestBase) hcRequest).setEntity(bae); // hcRequest.addHeader("Content-Type",contentType); } else if (reqMeth.equals("GET")) { hcRequest = new HttpGet(phaURLString); } else if (reqMeth.equals("DELETE")) { hcRequest = new HttpDelete(phaURLString); } } catch (java.io.UnsupportedEncodingException uee) { throw new IndivoClientException(uee); } // in case of form-url-encoded, will signpost know to look at Content-Type header and entity?? logger.info("pre signWithSignpost"); signWithSignpost(hcRequest, consumerKey0, consumerSecret0, phaToken, phaTokenSecret); logger.info("post signWithSignpost"); hcRequest.addHeader("Accept", "text/plain,application/xml"); // don't be mistaken for a browser logger.info("post signWithSignpost 1"); AbstractHttpClient httpClient = new DefaultHttpClient(); HttpParams httpParams0 = httpClient.getParams(); logger.info("post signWithSignpost 2"); Object connectionTimeout = options.get("connectionTimeout"); Object socketTimeout = options.get("socketTimeout"); logger.info("post signWithSignpost 3"); if (connectionTimeout == null) { connectionTimeout = defaultHttpTimeout; } if (socketTimeout == null) { socketTimeout = defaultHttpTimeout; } logger.info("post signWithSignpost 4"); if (!((socketTimeout instanceof Integer) && (connectionTimeout instanceof Integer))) { throw new IndivoClientException( "socketTimeout and connectionTimeout options must be ingeters. " + "sockenTimeout was " + socketTimeout.getClass().getName() + ", and connectionTimeout was " + connectionTimeout.getClass().getName()); } logger.info("about to set CONNECTION_TIMEOUT"); httpParams0 = httpParams0.setIntParameter( CoreConnectionPNames.CONNECTION_TIMEOUT, (Integer) connectionTimeout); httpParams0 = httpParams0.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, (Integer) socketTimeout); httpClient.setParams(httpParams0); HttpResponse httpResponse = null; // StatusLine statusLine = null; // InputStream istrm = null; org.apache.http.Header[] allheaders = hcRequest.getAllHeaders(); StringBuffer allheadersSB = new StringBuffer("\nall request headers:"); for (int ii = 0; ii < allheaders.length; ii++) { allheadersSB.append("\n" + allheaders[ii].getName() + " : " + allheaders[ii].getValue()); } logger.info("request: " + hcRequest.getMethod() + " " + hcRequest.getURI() + allheadersSB); try { httpResponse = httpClient.execute(hcRequest); } catch (java.net.ConnectException conE) { conE.printStackTrace(); logger.warn("connectionTimeout, socketTimeout: " + connectionTimeout + ", " + socketTimeout); throw new IndivoClientConnectException( "connectionTimeout, socketTimeout: " + connectionTimeout + ", " + socketTimeout, conE); } catch (Exception excp) { excp.printStackTrace(); logger.warn("phaRequestPart1 exception"); throw new IndivoClientException( "connectionTimeout, socketTimeout: " + connectionTimeout + ", " + socketTimeout, excp); } return httpResponse; }