我目前在连接到笔记本电脑#1的RPi上运行一个python应用程序。我用过
// init mocks
when(service.getPersons(anyInt())).thenReturn(Mono.just(person));
// execute rest resource
client.get() // invoked method
.uri("/persons/1") // requested path
.accept(MediaType.APPLICATION_JSON)
.exchange()
.expectStatus().isOk() // response code
.expectHeader().contentType(MediaType.APPLICATION_JSON)
.expectBody()
.jsonPath("$.firstName").isEqualTo(person.getFirstName())
.jsonPath("$.lastName").isEqualTo(person.getLastName())
// verify you have called your expected methods
verify(service).getPerson(1);
将笔记本电脑#1的任何请求转发到RPi,并可以成功地以
的形式发出PATCH请求 ssh -Nf -L localhost:9999:localhost:5000 pi@raspberrypi.local
(这只是打开LED引脚)
无论如何,我想从另一个笔记本电脑#2(以及希望是其他任何机器,以便可以从任何地方更改灯)发出相同的请求。我尝试仅将本地主机切换到笔记本电脑#1的IP地址,但这没有用。我相信当我使用端口9999时可以打开监听
curl -X PATCH "http://localhost:9999/pins/1" -H "Content-Type: application/json" -d "{\"state\": \"on\"}"
我回来了:
netstat -a | grep -i "listen"
ssh 16551 joshwh 8u IPv6 0x37a4856739271d0d 0t0 TCP [::1]:distinct (LISTEN)
任何想法都将不胜感激。