| 486 | } |
| 487 | |
| 488 | def connect_to_adapter(self, address): |
| 489 | assert self.channel is None |
| 490 | |
| 491 | self.before_connect(address) |
| 492 | host, port = address |
| 493 | log.info("Connecting to {0} at {1}:{2}", self.adapter_id, host, port) |
| 494 | |
| 495 | self.expected_adapter_sockets["client"]["port"] = port |
| 496 | |
| 497 | ipv6 = host.count(":") > 1 |
| 498 | sock = sockets.create_client(ipv6) |
| 499 | sock.connect(address) |
| 500 | |
| 501 | stream = messaging.JsonIOStream.from_socket(sock, name=self.adapter_id) |
| 502 | self._start_channel(stream) |
| 503 | |
| 504 | def start(self): |
| 505 | config = self.config |