Recently I was working on a migration to a SQL Server 2012 environment. After we had created our performance environment where we had created an availability group listener (AGL) I received complaints from my developers that they could not connect. Initially they were issues using the 2008 R2 client which was resolved by asking them to upgrade their client. However they were receiving the following error from their application:
Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=21033; handshake=310;
I did some testing on my own and was not getting this error even when using a C# console test application. The unfortunate situation here is that this error message is very generic. Some initial investigating (searching Google) I did not find any solutions that applied to this case. Many related to older versions of SQL Server. The solution was finally found as there was an article from Microsoft's knowledge base (http://support.microsoft.com/kb/2870437). The issue is with a TDI driver issue. Applying the hotfix the issue was resolved and I was now able to connect via the connection string that previously did not work.
Part of testing this was using a tool I created (AGLPing) that allows me to test multi-subnet response times. Because this was an exe it makes the solution portable. You can download the code for this tool and use it as you wish via Github: https://github.com/russ960/AGLPing