void BindInternal(IProtocolFactory factory, IPEndPoint local, IPEndPoint remote)
        {
            _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            _factory = factory;

            _factory.StartedConnecting();

            try
            {
                _socket.Bind(local);

                if (remote != null)
                {
                    _socket.Connect(remote);
                }
            }
            catch (SocketException ex)
            {
                _factory.ConnectionFailed(ex);

                return;
            }
            catch (ObjectDisposedException ex)
            {
                _factory.ConnectionFailed(ex);

                return;
            }

            Protocol protocol = _factory.BuildProtocol();

            SocketConnection connection = new DatagramSocketConnection(_reactor, protocol);
            connection.StartConnection(_socket, protocol.ReceiveBufferSize);
            protocol.MakeConnection(connection);
        }