public static void connectToHost(String[] args){
		
		 String host = null;
		 
	        int port = -1;
	       
	        if (args.length < 2) {
	            System.out.println("ILLEGAL ARGUMENT; USAGE: java client host port");
	            System.exit(-1);
	        }
	        try { // get input parameters 
	            host = args[0];
	            port = Integer.parseInt(args[1]);
	        } catch (IllegalArgumentException e) {
	            System.out.println("ILLEGAL ARGUMENT; USAGE: java client host port");
	            System.exit(-1);
	        }

	        try { // set up a key manager for client authentication 
	            SSLSocketFactory factory = null;
	            boolean success = false;
	            while(!success){
	            	try {
	            		String user = getUser();
	            		char[] password = getPassword();
	            		KeyStore ks = KeyStore.getInstance("JKS");
	            		KeyStore ts = KeyStore.getInstance("JKS");
	            		KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
	            		TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
	            		SSLContext ctx = SSLContext.getInstance("TLS");
	            		
	            		ks.load(new FileInputStream("../Projekt2/Client/" +user+"/keystore"), password);  // keystore password (storepass)
	            		ts.load(new FileInputStream("../Projekt2/Client/TrustStore/truststore"),trustStorePw.toCharArray()); // truststore password (storepass);
	            		kmf.init(ks, password); // user password (keypass)
	            		tmf.init(ts); // keystore can be used as truststore here
	            		ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
	            		factory = ctx.getSocketFactory();
	            		success = true;
	            	} catch (Exception e) {
	            		System.out.println("Invalid username or password");
	            	}
	            	
	            }
	            SSLSocket socket = null;
	            try{
	            	socket = (SSLSocket)factory.createSocket(host, port);
	            }catch(ConnectException e){
	            	System.out.println("Server offline, try again later");
	            	System.exit(1);
	            }

	            /*
	             * send http request
	             *
	             * See SSLSocketClient.java for more information about why
	             * there is a forced handshake here when using PrintWriters.
	             */
	            socket.startHandshake();

	            SSLSession session = socket.getSession();
	            X509Certificate cert = (X509Certificate)session.getPeerCertificateChain()[0];
	            

	            communicate(socket);
            
	        	
	    		
	            socket.close();
	        } catch (Exception e) {
	            e.printStackTrace();
	        }
		
		
	}