Socket s ........
KeyPair pair ........
Cipher cipherDe = Cipher.getInstance("RSA");
Cipher cipherEn = Cipher.getInstance("RSA");
           
cipherEn.init(Cipher.ENCRYPT_MODE, foreignKeyPub);
cipherDe.init(Cipher.DECRYPT_MODE, pair.generateKeyPair().getPrivate());
           
CipherOutputStream cos = new CipherOutputStream(s.getOutputStream(), cipherEn);
CipherInputStream cis = new CipherInputStream(s.getInputStream(), cipherDe);
           
wy = new ObjectOutputStream(cos);
we = new ObjectInputStream(cis);

moj problem polega na tym ze nie chce mi sie otworzyc ObjectInputStream(cis)
nie wywala mi zadnego bledu tylko zawiesza aplikacje