Current bitcoin-master on testnet, `maxconnections=8` in the config file. Running in VM that doesn't have public IP and is not reachable from the Internet.

Wait until you have 8 peers.

```
telnet localhost 18333
```

It will result in:

```
Assertion failed: (nMaxInbound > 0), function AcceptConnection, file net.cpp, line 973.
```

First found in https://github.com/bitcoin/bitcoin/pull/8996, but can be reproduced on master.

{
                if (pnode->fDisconnect ||
                    (pnode->GetRefCount() <= 0 && pnode->vRecvMsg.empty() && pnode->nSendSize == 0 && pnode->ssSend.empty()))
                {
                    
                    vNodes.erase(remove(vNodes.begin(), vNodes.end(), pnode), vNodes.end());
                    
                    pnode->grantOutbound.Release();
                    
                    pnode->CloseSocketDisconnect();
                    
                    if (pnode->fNetworkNode || pnode->fInbound)
                        pnode->Release();
                    vNodesDisconnected.push_back(pnode);
                }
            }
        }
        {
            
            std::list<CNode*> vNodesDisconnectedCopy = vNodesDisconnected;
            BOOST_FOREACH(CNode* pnode, vNodesDisconnectedCopy)