public function testApiHandleConnect_ClosesConnection_WhenIPIsNotValid()
{
$host = 'host';
$conn = $this->getMock(NetworkConnection::class, [], [], '', false);
$conn->expects($this->once())->method('getHost')->will($this->returnValue($host));
$conn->expects($this->once())->method('close');
$server = $this->createServer();
$component = $this->createComponent();
$component->expects($this->never())->method('handleConnect');
$firewall = $this->createFirewall($server, $component, ['isAddressBlocked']);
$firewall->expects($this->once())->method('isAddressBlocked')->with($host)->will($this->returnValue(true));
$firewall->handleConnect($conn);
}