I was trying to connect to one of the linux server through a java code and it wasnt working – code and exception mentioned below :

After a lot of tries, i found the solution.

I just added all those algorithms – KexAlgorithms diffie-hellman-group14-sha1 in the /etc/sshd_config and then restarted sshd and that helped me !! Give a Try !