I need a local HTTP server for my unit test.
When I try to activate TIdHTTPServer at SetUp
, it fails with EThread message:
"Thread Error: descriptor not valid (6)"
This is how I initialize it:
type
TestMyUnit = class(TTestCase)
...
procedure TestMyUnit.SetUp;
begin
FServer := TIdHTTPServer.Create(nil);
FServer.OnCommandGet := HTTPServerCommandGet;
FServer.Active := True; // <---- This will cause error
end;
Maybe there are some restrictions using Indy's TIdHTTPServer with DUnit framework?
- Delphi 2010
- Indy 10
Exception was thrown somewhere after this line in TIdListenerThread.Run
proc (IdCustomTCPServer unit)
LIOHandler := Server.IOHandler.Accept(Binding, Self, LYarn);
However, I can't trace it deeper, I don't know why.