How to fix 'Could not proxy command to remote server. Original error: Error: socket hang up' issue when scrolling in appium?

I tried to scroll iOS application using appium, this error occurs as when the scroll finishes.

I use a real iOS device as an emulator.
appium v1.13
java client v6.1.0

Code for scroll:

JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> swipeObject = new
HashMap<String, String>();

swipeObject.put(“direction”, “up”); // up for swipe
js.executeScript(“mobile: scroll”, swipeObject);

Full error message:

Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: Error: socket hang up

After the scrolling all the way to the bottom, one button needs to be clicked. but this scrolls all the way to the bottom and exit with this error.