Updated and simplified JS connection state test