I found that it works with another iphone, but it also works with the same iphone in another position.
I don't know specifically what is the cause, but the charger works with the phone, so it is not the pins most likely of the phone itself.
I also tried an apple brand lighting end wired headphone set. It did not have the problem of intermittent connection.
The adapter plugged into the old set above does not seem to have a problem when it is just laying down on something or in my hands while stationary, but if it is basically in a protective case and in motion, it will stop working without becoming disconnected from the device. It just is not detected anymore when I am moving around, but it is still fully plugged in. Then if I set the phone down, and plug it in, it will work.
I do not know what that means.