Although the relationship had appeared to have fallen on rocky ground after Kim Jong Un took the reigns of power following his father Kim Jong Il, the two countries have much more in common than meets the eye and their destinies are joined at the hip so to speak both having communist parties which took power almost 70 years ago.
Xi jin Ping the leader of China has courted Kim Jong Un twice in recent months having never invited him to Beijing previously. The families of Xi Jin Ping and Kim Jong Un go back to their respective fathers and being faced with an unpredictable President Trump have caused the two communist leaders to forge new ties to try and prevent the inevitable: the fall of both communist parties as did the communist party of the former Soviet Union. The wagons are circling for one last stand.
Here is a related article: http://www.breitbart.com/national-security/2017/11/23/bully-of-asia-china-north-korea-xi-jinping/